Search code examples
javascriptbrowsercross-browseruser-agentnavigator

navigator.userAgent different for each browser, what is the meaning of values in it?


I was very curious to know about values in result of navigator.userAgent.

I executed navigator.userAgent in chrome, FireFox and IE 8

and results I got are,

In IE8 ==> 

     "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64;
     Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR
     3.0.30729; InfoPath.2)"

In chrome ==>

     "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 
        (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36"

In FireFox ==>

     "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0"

Can someone please explain values in each result.

Thanks in advance..


Solution

  • navigator.userAgent returns a string. See the general format for it.

    userAgent = appCodeName/appVersion number (Platform; Security; OS-or-CPU; 
    Localization; rv: revision-version-number) product/productSub 
    Application-Name Application-Name-version
    

    example : Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.2) Gecko/20010725 Netscape6/6.1

    Here

    • AppCodeName = Mozilla
    • AppVersion number = 5.0
    • Platform = Windows
    • Security = U ( The type of security encryption included. Possible values are U (128-bit encryption), I (40-bit encryption), and N (no encryption).)
    • OS-or-CPU = Win98
    • Localization = en-US (Indicate the language used. Here it is US-English).
    • Revision-version-number = 0.9.2
    • Product = Gecko (The Gecko rendering engine is at the heart of Firefox.)
    • ProductVersion = 20010725
    • Application-Name = Netscape6
    • Application-Version = 6.1

    For more details see the History of the user-agent string