Can I Imitate Another Browser/Platform?
There are many ways to spoof user agent strings. In firefox, there happens to be an extension called "User Agent Switcher," which allows you to imitate other browsers.
https://addons.mozilla.org/en-US/firefox/addon/59
User Agents
Checking the user-agent often times can tell you this. For instance, my user-agent is:
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.38 Safari/532.0
Which platform am I on?
Javascript Option
You can also use the navigator
object in Javascript to get some information too. For instance:
alert(navigator.platform); // alerts Win32
alert(navigator.userAgent); // Mozilla/5.0 (Windows; U; Windows NT 6.0...
PHP Options
You can get the user-agent in PHP from the $_SERVER array:
print $_SERVER["HTTP_USER_AGENT"]; // Mozilla/5.0 (Windows; U; Windows NT...
PHP also has further goodies, such as the get_browser()
* function in PHP which returns an array of information, including the platform
:
Array
(
...
[parent] => Firefox 0.9
[platform] => WinXP
[browser] => Firefox
[version] => 0.9
...
)
* get_browser()
relies upon browscap.ini - See
http://www.php.net...php#ini.browscap for more information.