强制 Internet Explorer 在 Edge 中打开网站

dag*_*ega 6 html meta internet-explorer microsoft-edge

我刚刚在 Internet Explorer 中访问了 apple.com 网站并注意到,Internet Explorer 直接在 Edge 中打开该网站并在 IE 窗口中显示此页面

我也想在我的网站上实现这一点,所以我不必为 IE 优化所有功能。你有什么想法,这怎么可能?

我找到了这个片段,但它不起作用: <meta http-equiv="X-UA-Compatible" content="IE=edge">

答案很简单,可以在这里找到:https : //docs.microsoft.com/en-us/microsoft-edge/web-platform/ie-to-microsoft-edge-redirection#request-an-update-to-即兼容性列表

Ale*_*shy 1

在网站的开头运行此代码:

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;
}
Run Code Online (Sandbox Code Playgroud)

这是一个 hack,但如果用户在浏览器上启用了 active X,它应该可以工作。如果没有,他会收到启用它的提示。