How does Chrome detect the operating system

scrat.squirrel

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?

José Tomás Tocino

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to detect operating system with GIMP scheme?

From Dev

React Js How to detect current Operating System

From Dev

How does bash get commands into the operating system?

From Dev

How does a network port work?(operating system)

From Dev

How does design in an operating system work?

From Dev

How does Linux operating system shut down?

From Dev

How does the operating system manage processes

From Dev

how to tell what operating system is being used from chrome app?

From Dev

System does not boot to operating system

From Dev

How does the operating system recognize end of a text file?

From Dev

How does the operating system handle its responsibilities while a process is executing?

From Dev

How does the operating system post io completion messages for async io

From Dev

How does the operating system post io completion messages for async io

From Dev

How does the operating system handle its responsibilities while a process is executing?

From Dev

How does a linux-based operating system handle applications?

From Dev

How does the operating system recognize USB Rubber Ducky as a keyboard?

From Dev

is it possible to detect operating system in c++?

From Dev

How to write an operating system

From Dev

efi does not detect any operating systems

From Dev

How to detect Blink in Chrome

From Dev

Detect via JavaScript if mobile operating system is used by the users device

From Dev

Could not detect the operating system in disc image of kali linux

From Dev

In which operating system does my terminal run?

From Dev

Which physical core does the operating system use?

From Dev

What does gate mean in the Multics operating system?

From Dev

In which operating system does my terminal run?

From Dev

Does Operating System modify BIOS in any way?

From Dev

Does float size depend on operating system?

From Dev

System does not detect USB pendrives

Related Related

  1. 1

    How to detect operating system with GIMP scheme?

  2. 2

    React Js How to detect current Operating System

  3. 3

    How does bash get commands into the operating system?

  4. 4

    How does a network port work?(operating system)

  5. 5

    How does design in an operating system work?

  6. 6

    How does Linux operating system shut down?

  7. 7

    How does the operating system manage processes

  8. 8

    how to tell what operating system is being used from chrome app?

  9. 9

    System does not boot to operating system

  10. 10

    How does the operating system recognize end of a text file?

  11. 11

    How does the operating system handle its responsibilities while a process is executing?

  12. 12

    How does the operating system post io completion messages for async io

  13. 13

    How does the operating system post io completion messages for async io

  14. 14

    How does the operating system handle its responsibilities while a process is executing?

  15. 15

    How does a linux-based operating system handle applications?

  16. 16

    How does the operating system recognize USB Rubber Ducky as a keyboard?

  17. 17

    is it possible to detect operating system in c++?

  18. 18

    How to write an operating system

  19. 19

    efi does not detect any operating systems

  20. 20

    How to detect Blink in Chrome

  21. 21

    Detect via JavaScript if mobile operating system is used by the users device

  22. 22

    Could not detect the operating system in disc image of kali linux

  23. 23

    In which operating system does my terminal run?

  24. 24

    Which physical core does the operating system use?

  25. 25

    What does gate mean in the Multics operating system?

  26. 26

    In which operating system does my terminal run?

  27. 27

    Does Operating System modify BIOS in any way?

  28. 28

    Does float size depend on operating system?

  29. 29

    System does not detect USB pendrives

HotTag

Archive