html - 强制 Internet Explorer 在 Edge 中打开网站

标签 html internet-explorer microsoft-edge meta

关闭。这个问题需要details or clarity .它目前不接受答案。












想改善这个问题吗?通过 editing this post 添加详细信息并澄清问题.

10 个月前关闭。




Improve this question




我刚刚在 Internet Explorer 中访问了 apple.com 网站,发现 Internet Explorer 直接在 Edge 中打开了该网站和 shows this page在 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-the-ie-compatibility-list

最佳答案

在您网站的一开始运行此代码:

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,但如果用户在他的浏览器上启用了 active X,它应该可以工作。如果没有,他会收到启用它的提示。

关于html - 强制 Internet Explorer 在 Edge 中打开网站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64138312/

相关文章:

javascript - jQuery 选项卡,多个选项卡只有一个面板

html - IE 6 png透明度问题

java - 如何在 IE8 上启用 JavaScript?

c# - IE7 中由 JavaScript 和图像引起的混合内容警告

c# - Edge 浏览器 WebDriver 故障

javascript - 需要干净 chop 文本以显示更多 - 更少

php - 如何在另一个php文件中列出一个php文件的值

javascript - IE 10 不会在文本输入上重新应用填充

html - 为什么我的网站比 IE 和 Edge 中的视口(viewport)宽大约 50%?

html - 仅 Edge 中的自定义复选框问题