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

Chapter 34. Cross-Browser Solutions: Det... > Detecting the User's Browser

Detecting the User's Browser

The heart and soul of any cross-browser script, function, or code is browser detection. Only when you know what browser the user is running (and, depending on the code or feature you're using, the browser version and the user's operating system) can you redirect the user to run whatever code works best with his browser. Thee are two types of detection: browser version detection and object detection.

Using Browser Version Detection

Browser version detection involves examining information returned by the user's browser: its name, its version number, its operating system, and so on. All of this is returned by the Navigator object, which I discussed back in Chapter 16, "Controlling the Browser: The Navigator Object." In that chapter I showed you a "browser sniffer" script that examines various Navigator object properties and sets a number of Boolean variables based on the Navigator values.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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