RochCass: Detecting IE10 and IE11Browsers

Since IE10, browser detection tags such as (.ie or .ie9 etc) are no longer support to identify the version of the IE browser. As a matter of fact, IE is no longer even recognized as an IE browser. Instead, if you search for the User-Agent in your request header, you will see that IE10 and IE11 have a User-Agent of a Mozilla Browser: "User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko".

I thought that this means, all rendering should look like any other Mozilla rendering (Firefox). However, it was not the case. I needed to specify a certain css styling only for IE10+ browsers and could not seem to find a way of doing so without using JavaScript.


Paste the following code between script tags at the end of your page before the body closing tag:

if (document.body.style["msScrollLimit"] == undefined){
    //NOT IE10+ Browser
    alert("You are not using IE10 or IE11");
}
else if (document.body.style["msScrollLimit"] != undefined){
    //IE10+ Browser

    //msTextCombineHorizontal is a css property only accepted using IE10+
    if (document.body.style["msTextCombineHorizontal"] == undefined){
      //IE10 Browser
      alert("You are using IE10");
    }
    if (document.body.style["msTextCombineHorizontal"] != undefined){
      //IE11 Browser
      alert("You are using IE11");
    }
}

Goodluck :)

Back to Article