强制Internet Explorer在Edge中打开网站

6
我刚访问了苹果公司的网站,在Internet Explorer中注意到,Internet Explorer会直接在Edge中打开网站,并在IE窗口中显示此页面
我希望也能实现这一点,这样我就不用为IE优化所有功能了。你有什么想法,如何实现这一点?
我找到了这个代码片段,但它不起作用:<meta http-equiv="X-UA-Compatible" content="IE=edge"> 答案非常简单,可以在这里找到:https://learn.microsoft.com/en-us/microsoft-edge/web-platform/ie-to-microsoft-edge-redirection#request-an-update-to-the-ie-compatibility-list

1
我认为这是由Edge Chromium组策略控制而非代码。您可以参考我的回答了解GPO的工作原理。您可以在您的计算机上检查GPO设置,并参考官方文档 - Yu Zhou
2
此外,伊斯兰教的解决方案也可以是一种变通方法,使用Edge Chromium,您可以使用shell.run("microsoft-edge:http://yoursite");。但它不会显示您在问题中提供的页面,因此我认为您看到的结果仍然受GPO控制。 - Yu Zhou
2
这个回答解决了你的问题吗?如何像 Stack Overflow 一样将 IE11 重定向到 Edge - Llamax
@Llamax 是的,那正是我在寻找的。谢谢! - dagrega
1个回答

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;
}

这是一种hack方法,但如果用户的浏览器启用了ActiveX,则应该可以正常工作。如果没有启用,他将收到提示以启用它。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接