Return to Snippet

Revision: 3743
at September 9, 2007 20:43 by arunpjohny


Updated Code
isMac = (navigator.appVersion.indexOf(”Mac”)!=-1) ? true : false;
NS4 = (document.layers) ? true : false;
IEmac = ((document.all)&&(isMac)) ? true : false;
IE4plus = (document.all) ? true : false;
IE4 = ((document.all)&&(navigator.appVersion.indexOf(”MSIE 4.”)!=-1)) ? true : false;
IE5 = ((document.all)&&(navigator.appVersion.indexOf(”MSIE 5.”)!=-1)) ? true : false;
IE6 = ((document.all)&&(navigator.appVersion.indexOf(”MSIE 6.”)!=-1)) ? true : false;
IE7 = ((document.all)&&(navigator.appVersion.indexOf(”MSIE 7.”)!=-1)) ? true : false;
ver4 = (NS4 || IE4plus) ? true : false;
NS6 = (!document.layers) && (navigator.userAgent.indexOf(’Netscape’)!=-1)?true:false;

/*
* We can also use
*/
#
if (typeof document.body.style.maxHeight != "undefined") {
#
  // IE 7, mozilla, safari, opera 9
#
} else {
#
  // IE6, older browsers
#
}

//or

if (window.XMLHttpRequest) {
// IE 7, mozilla, safari, opera 9
} else {
// IE6, older browsers
}

Revision: 3742
at September 9, 2007 20:32 by arunpjohny


Initial Code
isMac = (navigator.appVersion.indexOf(”Mac”)!=-1) ? true : false;
NS4 = (document.layers) ? true : false;
IEmac = ((document.all)&&(isMac)) ? true : false;
IE4plus = (document.all) ? true : false;
IE4 = ((document.all)&&(navigator.appVersion.indexOf(”MSIE 4.”)!=-1)) ? true : false;
IE5 = ((document.all)&&(navigator.appVersion.indexOf(”MSIE 5.”)!=-1)) ? true : false;
IE6 = ((document.all)&&(navigator.appVersion.indexOf(”MSIE 6.”)!=-1)) ? true : false;
IE7 = ((document.all)&&(navigator.appVersion.indexOf(”MSIE 7.”)!=-1)) ? true : false;
ver4 = (NS4 || IE4plus) ? true : false;
NS6 = (!document.layers) && (navigator.userAgent.indexOf(’Netscape’)!=-1)?true:false;

Initial URL


Initial Description


Initial Title
Detecting Browser Version

Initial Tags
javascript

Initial Language
JavaScript