如何从 Internet Explorer 无缝重定向到 Microsoft Edge?
How to redirect from Internet Explorer to Microsoft Edge seamlessly?
我正在尝试在我的网站上弃用 Internet Explorer,并且我想在有人尝试在 Internet Explorer 上访问该网站时复制 Twitter 的行为。
从我目前拼凑的他们的流程来看,似乎有一个基于用户代理字符串的服务器端检查,该字符串检测浏览器类型,然后发送一些内容重定向到 https://go.microsoft.com/fwlink/?linkid=2135547 but simultaneously opens up Microsoft Edge and directs that to https://twitter.com
让我感到困惑的是,他们如何设法打开 Microsoft Edge,而不打开一个对话框,询问您是否要使用该应用程序打开 link。我看到网站使用 microsoft-edge:url
在 Microsoft Edge 中打开 url,但它总是询问您是否要打开该应用程序。
如果有人知道他们如何管理它或如何复制它,我们将不胜感激。
如果有帮助,我的网站是建立在 express.js 上的,我正在尝试的重定向是基于某些 express 中间件中的 res.redirect
。
当我尝试在 IE 11 浏览器中访问 Twitter 时,页面上显示以下消息。它没有重定向到任何 Microsoft 页面,也没有在 Edge 浏览器中启动 Twitter 页面。
所以我不确定你是如何在你的机器上出现这种行为的。
我知道您想要避免要求用户允许站点在 Edge 浏览器中打开的弹出窗口。
我没有得到任何可以抑制该弹出窗口的设置。我建议尝试使用能够识别浏览器并显示一个link的JS代码在Edge浏览器中打开站点。如果用户单击 link,则不会显示弹出窗口,Edge 浏览器将直接启动。
示例代码:
<!doctype html>
<html>
<head>
<script>
function FindIE() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./))
{ document.write("The Internet Explorer browser is not supported by this site. We suggest you visit the site using supported browsers." + "<A HREF='microsoft-edge:http://<<Your site address..........>>'>Click here to launch the site in the MS Edge browser</A>");
}
else
{
document.write("Welcome...");
}
return false;
}
FindIE()
</script>
</head>
<body>
</body>
</html>
在 IE 11 浏览器中的输出:
此外,您可以尝试修改代码以使其与 express.js
一起使用
这似乎是 Internet Explorer 和 Edge 之间的一个特殊界面,它使用名为“IEtoEdge BHO”的 Internet Explorer 浏览器帮助程序对象以及由 Microsoft 维护的不兼容网站列表。
这需要 Microsoft Edge 稳定版 87 或更高版本。
https://docs.microsoft.com/en-us/deployedge/edge-learnmore-neededge
除了 Edge 中用于迁移浏览数据和首选项的对话框外,以下代码与行为非常相似。我没有收到任何提示,所以可能已经改变了。
<script>
if(/MSIE \d|Trident.*rv:/.test(navigator.userAgent)) {
window.location = 'microsoft-edge:' + window.location;
setTimeout(function() {
window.location = 'https://go.microsoft.com/fwlink/?linkid=2135547';
}, 1);
}
</script>
虽然 Molanda 和 Deepak-MSFT 的回答有效。 Molanda answer 会将 windows 8.1, 2016, 2019 没有边缘的用户重定向到一个页面,告诉他们使用他们没有的浏览器。 Deepak-MSFT 要求用户单击 link.
感谢 navigator.msLaunchUri,您可以响应对 Microsoft-Edge 的支持。请注意,如果您仍然关心它,这在 Windows 7 中将不起作用。
if (typeof (navigator.msLaunchUri) === "function") {
navigator.msLaunchUri('microsoft-edge:' + window.location.href,
function () { window.location.href="https://go.microsoft.com/fwlink/?linkid=2151617" },
function () {console.log('ie but no edge')}
)
}
我正在尝试在我的网站上弃用 Internet Explorer,并且我想在有人尝试在 Internet Explorer 上访问该网站时复制 Twitter 的行为。
从我目前拼凑的他们的流程来看,似乎有一个基于用户代理字符串的服务器端检查,该字符串检测浏览器类型,然后发送一些内容重定向到 https://go.microsoft.com/fwlink/?linkid=2135547 but simultaneously opens up Microsoft Edge and directs that to https://twitter.com
让我感到困惑的是,他们如何设法打开 Microsoft Edge,而不打开一个对话框,询问您是否要使用该应用程序打开 link。我看到网站使用 microsoft-edge:url
在 Microsoft Edge 中打开 url,但它总是询问您是否要打开该应用程序。
如果有人知道他们如何管理它或如何复制它,我们将不胜感激。
如果有帮助,我的网站是建立在 express.js 上的,我正在尝试的重定向是基于某些 express 中间件中的 res.redirect
。
当我尝试在 IE 11 浏览器中访问 Twitter 时,页面上显示以下消息。它没有重定向到任何 Microsoft 页面,也没有在 Edge 浏览器中启动 Twitter 页面。
所以我不确定你是如何在你的机器上出现这种行为的。
我知道您想要避免要求用户允许站点在 Edge 浏览器中打开的弹出窗口。
我没有得到任何可以抑制该弹出窗口的设置。我建议尝试使用能够识别浏览器并显示一个link的JS代码在Edge浏览器中打开站点。如果用户单击 link,则不会显示弹出窗口,Edge 浏览器将直接启动。
示例代码:
<!doctype html>
<html>
<head>
<script>
function FindIE() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./))
{ document.write("The Internet Explorer browser is not supported by this site. We suggest you visit the site using supported browsers." + "<A HREF='microsoft-edge:http://<<Your site address..........>>'>Click here to launch the site in the MS Edge browser</A>");
}
else
{
document.write("Welcome...");
}
return false;
}
FindIE()
</script>
</head>
<body>
</body>
</html>
在 IE 11 浏览器中的输出:
此外,您可以尝试修改代码以使其与 express.js
一起使用这似乎是 Internet Explorer 和 Edge 之间的一个特殊界面,它使用名为“IEtoEdge BHO”的 Internet Explorer 浏览器帮助程序对象以及由 Microsoft 维护的不兼容网站列表。
这需要 Microsoft Edge 稳定版 87 或更高版本。
https://docs.microsoft.com/en-us/deployedge/edge-learnmore-neededge
除了 Edge 中用于迁移浏览数据和首选项的对话框外,以下代码与行为非常相似。我没有收到任何提示,所以可能已经改变了。
<script>
if(/MSIE \d|Trident.*rv:/.test(navigator.userAgent)) {
window.location = 'microsoft-edge:' + window.location;
setTimeout(function() {
window.location = 'https://go.microsoft.com/fwlink/?linkid=2135547';
}, 1);
}
</script>
虽然 Molanda 和 Deepak-MSFT 的回答有效。 Molanda answer 会将 windows 8.1, 2016, 2019 没有边缘的用户重定向到一个页面,告诉他们使用他们没有的浏览器。 Deepak-MSFT 要求用户单击 link.
感谢 navigator.msLaunchUri,您可以响应对 Microsoft-Edge 的支持。请注意,如果您仍然关心它,这在 Windows 7 中将不起作用。
if (typeof (navigator.msLaunchUri) === "function") {
navigator.msLaunchUri('microsoft-edge:' + window.location.href,
function () { window.location.href="https://go.microsoft.com/fwlink/?linkid=2151617" },
function () {console.log('ie but no edge')}
)
}