Shailesh Karkera
Shailesh Karkera

Reputation: 31

Internet Explorer ver 11 enterprise mode detection

Recently my team has landed in a weird situation. End of last year we migrated from IE 8 to IE 11. Our application is now designed to work in IE 11 Enterprise mode.

We need to display a javascript alert message to upgrade the Browser if the user is using IE 8. Alert message is successfully displayed to the users who use IE 8. But problem occurs when the alert message is also displayed to the users who are using IE11 in enterprise mode. I know that IE11 Enterprise mode basically emulates IE 8 behavior and that is the reason why our browser detection functionality is failing.

So I wanted to check if someone has implemented this kind of feature where they can successfully detect the IE version even if they are using IE 11 enterprise mode.

All responses are valuable. Appreciate your response !!!

Upvotes: 3

Views: 1743

Answers (3)

Yatin Tewari
Yatin Tewari

Reputation: 1

You can use document mode to check for Enterprise mode. Because in EM the document mode is set to IE 5 to IE 8. This check along with your browser check functionality should work.

How to get browser "Document Mode"

Upvotes: 0

moloko
moloko

Reputation: 478

I'm just looking into this myself. I did stumble across this recently - but couldn't get it to work reliably - however the concept of looking for a feature of IE that shouldn't normally be available is sound.

My plan now is to use IETruth to get the version number (it's very good at doing version detection for IE11) and then do something like:

var IE = IeVersion(); if(IE.TrueVersion < 9 && ('spellcheck' in document.createElement('textarea')) { // must be running in Enterprise mode because spellcheck wasn't introduced until IE10 }

I'll let you know how I get on!

Upvotes: 0

securecodeninja
securecodeninja

Reputation: 2515

As per MSDN:

As of Internet Explorer 11, the user-agent string has changed significantly...Sites that rely on the user-agent string should be updated to modern techniques, such as feature detection, adaptive layout, and other modern practices.

https://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx

Although IE11 in EM throws

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; Tablet PC 2.0)

It is not advisable to just look for "MSIE" in the userAgent but rather try:

var isIE11 = !!navigator.userAgent.match(/Trident.*rv[ :]*11\./)

Upvotes: 1

Related Questions