Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check website viewer's operating system?

I'm running Ubuntu 8.04 and I recently received the following error when visiting a website:

Please return to www.site.com with a computer running Windows 98, 2000, Me, NT, or XP.

  1. How does the website know which OS I'm running? Is it only via javascript or is there OS information in the request headers as well?

  2. Is there a way for me to bypass this check or "pretend" to be using Windows so that I can access the website even though I'm running an unsupported OS?

like image 660
MCS Avatar asked Dec 30 '09 02:12

MCS


People also ask

How do I know the operating system of a website?

Open the Check Website OS Checker. Enter a domain or IP address to check the OS, and click on the "Check Server OS" button. The tool instantly provides you with the server information behind the domain or IP address. You can go for Geo Lookup from the IP address to better understand the server's location.

Can website detect OS?

To detect the operating system on running website, one can simply use navigator. appVersion or navigator. userAgent property. The Navigator app Version or userAgent property is a read-only property and it returns a string which represents the operating system information of the browser.


3 Answers

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.

like image 108
Sampson Avatar answered Sep 20 '22 16:09

Sampson


How does the website know which OS I'm running? Is it only via javascript or is there OS information in the request headers as well?

That info goes in the User-Agent HTTP header each time you make a request to any server.

Is there a way for me to bypass this check or "pretend" to be using Windows so that I can access the website even though I'm running an unsupported OS?

Check this link for more info in User-Agent spoofing using firefox.

like image 37
Pablo Fernandez Avatar answered Sep 21 '22 16:09

Pablo Fernandez


You can use navigator.platform in JavaScript:

var OS = navigator.platform;
alert(OS);

That way you don't have to worry about parsing the user agent.

like image 25
Annie Avatar answered Sep 19 '22 16:09

Annie