• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 10. Using the navigator, locatio... > Using the userAgent Property

Using the userAgent Property

The most comprehensive information you can get about a browser is usually to be found in the navigator.userAgent property. Unfortunately, this string is not standardized, so you must search for the information you want using the JavaScript string methods (which we’ll discuss in Chapter 18, “The Date, Time, and String Objects”). Here are a few possible values for this string and what they mean—note that they always start with “Mozilla” because in the early days, scripts used to search for that word before assuming standard JavaScript compatibility:

  • "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4) Gecko/20011019 Netscape6/6.2". This is the string returned by Netscape Navigator 6.2 for U.S. Windows 2000.

  • "Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)". This is the string returned by Internet Explorer 5.0 for Windows 98 with digital security enabled.

  • "Mozilla/4.08(Win98; I ;Nav)". This is the string returned by Netscape Navigator 4.08 for Windows 98.

  • "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; COM+ 1.0.2204; .NET CLR 1.0.3512)". This is the string returned by Internet Explorer 6.0 for Windows 2000 with .NET installed.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint