Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

The following browser detection properties are available to all scripts:

pui.is_ie;             // Microsoft Internet Explorer
pui.ie_mode;           // Defined only if (is_ie == true)
pui.ie_version;        // Defined only if (is_ie == true)

pui.is_android;        // Indicates an Android device, not necessarily Android browser.
pui.is_chrome;         // Google Chrome
pui.is_firefox;        // Mozilla FireFox
pui.is_opera;          // Opera
pui.is_safari;         // Apple Safari
pui.is_touch;          // Is a touch device such as a mobile phone or tablet
pui.is_mouse_capable;  // The computer or device has a mouse attached

 

The pui.is_XX flags are Boolean type, and will always be defined. They will be set to true or false, as appropriate. The values pui.ie_version and pui.ie_mode are Number type values which are defined only when pui.is_ie is true. pui.ie_version gives the actual version number of Internet Explorer, and pui.ie_mode gives the Internet Explorer rendering mode. In most situations requiring browser detection, pui.ie_mode is the relevant value.

For example:

if (pui.is_ie && pui.ie_mode < 9) {

  // Do something different for IE8 and below.

}

See here for a discussion on browser detection.

  • No labels