Skip Ribbon Commands
Skip to main content

WDK

:

Code Samples: Detecting Browser type through javascript

To detect the browser type, WDK includes browser.js file which contains functions to detect the type of browser. The following is the snippet from \webtop\wdk\include\browser.js file 
 
function isNetscape() {
var strBrowser = window.navigator.userAgent.toLowerCase();
var result = false;
if (strBrowser.indexOf("mozilla") != -1) {
if (strBrowser.indexOf("msie") != -1) {
result = false;
} else {
result = true;
}
}
return result;

}
function isIE() {
var strBrowser = window.navigator.userAgent.toLowerCase();
var result = false;
if (strBrowser.indexOf("mozilla") != -1) {
if (strBrowser.indexOf("msie") != -1) {
result = true;
} else {
result = false;
}
}
return result;
}​