Browser sniffing – Detecting what browser is being used with Dojo

Even though Dojo does a great job in making cross browser and platform JavaScript development very easy there are times when you may want to do something that is specific for a browser.  Instead of re-inventing the wheel you can use the many functions in the Dojo library to help with this. There is an entire article on “browser sniffing” on the Dojo toolkit web site and it comes with a few good examples to learn from:

  • dojo.isIE
  • dojo.isMozilla
  • dojo.isFF
  • dojo.isOpera
  • dojo.isSafari
  • dojo.isKhtml
  • dojo.isAIR – true if running within the Adobe AIR enviroment
  • dojo.isQuirks – is the browser in Quirks-Mode
  • dojo.isBrowser (not typically needed when only targeting browsers)