Making Older Sites Compatible With Internet Explorer 10

Some times it might happen that an older website is not working properly in Internet Explorer 10. For example the jQuery popups are not opening but working in previous version of IE.

The reason behind it can be that the website contains doctype as , html tags are not correct or not as per HTML5 specifications and others which all together some how compatible till IE 9 but not in IE 10.

IE 10 will show an error as Invalid DOCTYPE. The shortest valid doctype is “”
which can lead to several unexpected side-effects if you’re unfamiliar with the directive.

And it very difficult to change the doc type as or change the entire website code structure to make it compatible with IE 10 which may not also work in IE 10 or can even break the site in older version too.

This issue can simply be fixed by using the below code in head tag.

 
where content='the_ie_version_your_site_is_compatible_with'.
the possible values are
"IE=5"
"IE=EmulateIE7"
"IE=7"
"IE=EmulateIE8"
"IE=8"
"IE=EmulateIE9"
"IE=9"
"IE=edge"

If there is a need to include the above meta tag only if the browser is IE 10 then it require to check the version of IE.

Condition comments are used to check browser version to include the html tag, run javascripts etc but it is supported till IE 9.
IE 10 and higher no longer supports conditional comments.

So in PHP the below code can be used to check the IE 10 and higher to include the meta tag.
Include the below code inside tag.

    

Other ways of identifying the IE browser version:

PHP:

 Javascript:

var ieVersion = /*@cc_on (function() {
                    switch(@_jscript_version) {
                        case 1.0:
                            return 3;
                        case 3.0:
                            return 4;
                        case 5.0:
                            return 5;
                        case 5.1:
                            return 5;
                        case 5.5:
                            return 5.5;
                        case 5.6:
                            return 6;
                        case 5.7:
                            return 7;
                        case 5.8:
                            return 8;
                        case 9:
                            return 9;
                        case 10:
                            return 10;
                    }
                })() || @*/ 0;

 HTML:(It works till ie9 as IE 10 and higher no longer supports conditional comments.)


150 150 Burnignorance | Where Minds Meet And Sparks Fly!