Force Internet Explorer to open a website in Edge

Viewed 2276

I just visited the apple.com website in the Internet Explorer and noticed, Internet Explorer opens the website directly in Edge and shows this page in the IE-window.

I'd like to implement this to my websites too, so i dont have to opimize all features for the IE. Do you have an idea, how this is possible?

I found this snippet, but it doesnt work: <meta http-equiv="X-UA-Compatible" content="IE=edge">

The answer is very simple can be found here: https://docs.microsoft.com/en-us/microsoft-edge/web-platform/ie-to-microsoft-edge-redirection#request-an-update-to-the-ie-compatibility-list

1 Answers

Run this code at the very start of your website :

if (isIE()) {
  // We open the website in Chrome if it's IE, note that ActiveXObject only works on IE
  var shell = new ActiveXObject("WScript.Shell");
  shell.run("Chrome https://google.com");
}

function isIE() {
  ua = navigator.userAgent;
  // MSIE used to detect old browsers and Trident used to newer ones
  var is_ie = ua.indexOf("MSIE ") > -1 || ua.indexOf("Trident/") > -1;
  return is_ie;
}

It's a hack, but it should work if the user has active X enabled on his browser. If not, he'll get a prompt to enable it.

Related