Pretty simple: I need to know how does Google Chrome browser detect on which operating system is running? I am mostly interested about the GNU/Linux flavor(s) in particular, say, how does Chrome know that it is running on Ubuntu vs. Debian or CentOS?
I don't think you can detect the GNU/Linux flavor from a website, if that's what you're asking. On the other hand, Google Chrome source code probably makes use of the information stored in the /etc/*-release
files present in your system.
For instance, you can parse the contents of /etc/os-release
to get the flavor of linux you're using.
Sample of my /etc/os-release
file:
NAME="Ubuntu"
VERSION="14.04.3 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.3 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
Sample Python script to parse it:
fields = {}
with open('/etc/os-release', 'r') as f:
for line in f:
key, value = line.strip().split('=')
fields[key] = value
print "You're running %s" % fields['ID']
Running it:
$ ./parse.py
You're running ubuntu
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments