1

we want to stop the support for IE8, in order to do that we need to find the browser and version that the client is using (we can do it in client side using navigator.userAgent or in server side [jsp] using the User-Agent header that the client sends with the request).

The problem is that we are forcing the browser to render the pages with the IE8 engine (document mode 8) using the metadata: <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8">, so the user will act like an IE 8 browser.

Is there anyway we can find the actual IE version, ignoring the document mode (compatibility mode)?

Oday
  • 141
  • 8
  • True IE 8 users are in a browser that supports Conditional Comments; have you considered using Conditional Comments to either display a limited-support message? – Sampson Nov 27 '14 at 00:56

2 Answers2

1

I figured a way to do it, we can do it by figuring out the Javascript interpreter version:

var IE = (function () {
        "use strict";
        var ret, isTheBrowser, actualVersion, jscriptMap, jscriptVersion;

        isTheBrowser = false;
        jscriptMap = {"5.5": "5.5", "5.6": "6", "5.7": "7", "5.8": "8", "9": "9", "10": "10", "11": "11"};
        jscriptVersion = new Function("/*@cc_on return @_jscript_version; @*/")();

        if (jscriptVersion !== undefined) {
            isTheBrowser = true;
            actualVersion = jscriptMap[jscriptVersion];
            if (actualVersion === undefined) {
                actualVersion = jscriptVersion;
            }
        } 

        ret = {isTheBrowser: isTheBrowser, actualVersion: actualVersion};

        return ret;
    }());
Oday
  • 141
  • 8
0

Yes.We can find using JQuery or using Java Script.

To find in Java Script we write :

 function checkBrowserVersion() {

            var ua = window.navigator.userAgent;
            var ie = ua.indexOf("MSIE ");

            if (ie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./))    
                alert(parseInt(ua.substring(ie + 5, ua.indexOf(".", ie))));
            else                 
                alert('Other Browser!!');
           return false;
         }

If you want to use Jquery then we can simply use:

if ( $.browser.msie ) {
  alert( $.browser.version );
}

Note:If you are using Jquery version 1.9 or greater than that then you have to include jquery-migrate plugin also. Happy Coding!!!

  • Thanks for the answer. Actually I tried your code but it did not work (maybe because of the migrate plugin - i did not try). I found a way and I'll post it. Thanks again. – Oday Dec 01 '14 at 07:40