Don Holmes
Don Holmes

Reputation: 23

Detecting browser in Edge IE mode

I've been looking at "IE mode" within Edge Chromium.

Everything I have currently runs in IE 11.

If in IE mode, do you know if the window.navigator... javascript stuff to detect browser, version, etc still returns IE 11 in "IE mode"?

What I have researched indicates "IE mode" is actual IE 11 launching in an Edge window (and there is a policy option to launch IE 11 standalone).

The Document mode link suggested below is before this point...the code already has the check for window.navigator.UserAgent....etc. I'm seeing if anybody knows if that will return IE stuff for "IE mode" within Edge.

thank you so much.

Upvotes: 2

Views: 6363

Answers (2)

Don Holmes
Don Holmes

Reputation: 23

Ok, thank you. I also found out that Internet Options in Win 10 is in Control Panel (not exclusive to IE). It looks to be the IE options interface but in a more generalized scope (so if you have IE Mode within Edge window, these should apply). It appears that zone-specific stuff like Initialize and script ActiveX controls not marked as safe for scripting can be set here. I tested these out and they do apply to IE

Upvotes: 0

Deepak-MSFT
Deepak-MSFT

Reputation: 11355

You had asked,"If in IE mode, do you know if the window.navigator... javascript stuff to detect browser, version, etc still returns IE 11 in "IE mode"?"

Tested code:

<!doctype html>
<html>
<head>
<title>
Test to detect IE browser
</title>

</head>
<body >
<div id="info"></div><br>
<h2>Test Page...</h2>

<script>
function Detect_IE() {
           var ua = window.navigator.userAgent;
         
           var msie = ua.indexOf('MSIE ');
           if (msie > 0) {
            
             return "IE " + parseInt( ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
           }
         
           var trident = ua.indexOf('Trident/');
           if (trident > 0) {
            
             var rv = ua.indexOf('rv:');
             return "IE " + parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
           }

           // other browser
           return "false";
         }
         var result=Detect_IE();
         if (result=="false")
         {
            document.getElementById("info").innerHTML +="<h2>Welcome to the site...</h2>";
         }
         else
         {
          document.getElementById("info").innerHTML += "<h2>Dear user you are using " + result + " <br><br> User Agent String = " + window.navigator.userAgent + "</h2>";
         }
</script>
</body>
</html>

Test result with the MS Edge 88.0.705.74 in the IE mode:

enter image description here

Upvotes: 3

Related Questions