PDA

View Full Version : detecting IE 6.0.2600 from 6.0.2800!!


rohanrehman
12-17-2002, 04:53 PM
Ie 6.0.2800 which cimes with Sp1 won't let you chrome the browser with js but 6.0.2600 will/
I know only know how to make the difference from x.x not x.x.xxxx. using ;

navigator.appVersion.indexOf("MSIE 6.0")

PLease write me a script that tells me how.


Thank you so much.

Skyzyx
12-17-2002, 08:57 PM
Something like this may help...


<html>
<head>
<script language="JavaScript" type="text/javascript">
<!--
var ua=navigator.userAgent;
var browser=new Array();

browser.ie=(ua.indexOf('MSIE') != -1);
browser.split=ua.split('MSIE');
browser.ver=parseInt(browser.split[1]);

browser.ie6=(browser.ie && browser.ver == 6) ? true:false;

if (browser.ie6)
{
if (navigator.appMinorVersion.indexOf('SP1') != -1) browser.ie6sp1=true;
else browser.ie6sp1=false;
}
//-->
</script>
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
if (browser.ie6sp1) document.write('This is Internet Explorer 6.0.2800 (or Service Pack 1)!');
else if (browser.ie6) document.write('This is Internet Explorer 6.0.2600 (Not Service Pack 1)!');
else if (browser.ie) document.write('This is Internet Explorer, but not version 6.');
else document.write('This is not Internet Explorer.');
//-->
</script>
</body>
</html>

Membie
12-17-2002, 11:11 PM
:thumbsup: Whooowwwwww.... I'm I glad with this script Skyzyx. Just logged in to say thanks. ;)

It ables me to use / redirect other browser users, etc., and to use chromeless windows for the time being, for as long as IE6 SP1 isn't browser standard 'yet'. (a month, a year, a week, a day:... who cares :D )

Thanks again!

Skyzyx
12-17-2002, 11:14 PM
Your welcome. And the reason why I used an array instead of variables is because it saves me the variables, and I think it helps organization (if you're sniffing multiple browsers).

rohanrehman
12-23-2002, 05:31 PM
Skyzx..........................................





YOU DA MAN

beetle
12-23-2002, 05:38 PM
Very nice...but some simpler code, no?browser.ie6 = (browser.ie && browser.ver == 6);


if (browser.ie6)
{
browser.ie6sp1 = (navigator.appMinorVersion.indexOf('SP1') != -1);
}
The ternary isn't needed ;)

Skyzyx
12-24-2002, 03:06 AM
You're right. But, I like to add it as a personal preference. I feel it adds a certain clarity...

beetle
12-24-2002, 04:03 AM
How about this then?

browser.ie6 = Boolean(browser.ie && browser.ver == 6);