Automatic IE upgrades
by , 05-10-2013 at 07:55 PM (32587 Views)
A couple of days ago, I noticed that I have IE10 on my computer, although I did not install this latest IE-version myself. Apparently, Microsoft has started automatic upgrades of IE to its latest version(s).
So I wanted to know how my sites looked like with IE10 (I normally use Firefox). They looked normal, but the javascript on certain pages produced unwanted results that were not problematic until now (with IE7/8/9).
At first, I was unable to find out what caused the trouble. Then I remembered having read somewhere that support for conditional comments has been removed in IE10. So I removed the comments and replaced them with (javascript browser) sniffing lines and voilą: everything was fine again.
Here's the javascript I used (it seems reliable):
if(/*@cc_on!@*/false){} // if IE
if(/*@cc_on!@*/true){} // if not IE
if (ieversion==7){} // if IE7
if (ieversion>7){} // if IE8 and up
if (ieversion>=8) // if IE8 and up
etc.
For the ie-version lines I used the following script:
<script type="text/javascript">
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent))
{ //test for MSIE x.x;
var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
}
</script>
I hope this may be useful.








