【发布时间】:2022-01-11 10:21:36
【问题描述】:
我使用 ActiveXObject 为我的网站创建了一个从 IE11 到 Chrome 的重定向链接,当我在 IE 中打开链接时它可以工作,但是当我在 Chrome 中打开该重定向链接时它不起作用,有没有办法解决这个问题.
<html lang="en">
<head>
<meta charset="utf-8">
<title> Redirect</title>
<h1>Browser Redirect</h1>
<script type="text/javascript">
{
varshell= new ActiveXObject("WScript.Shell");
shell.run("Chrome http://example.com");
}
setTimeout("pageRedirect()",3000);
</script>
</head>
</html>
【问题讨论】:
-
Chrome 不支持 ActiveXObject。此示例也仅适用于非常有限的 IE11 情况,并且通常需要修改安全设置。 (有一些 Chrome 插件通过在选项卡中嵌入 IE 来做或做过;这超出了问题的范围。)
-
“正常”重定向,在当前浏览器中,只需分配给
window.location- stackoverflow.com/q/503093/2864740 即可完成(有一些变体,还有一些不太常见的替代方案) -
您还想在 Chrome 中重定向到另一个网站吗?如果是这样,我认为斯蒂芬奥斯特米勒的回答是正确的。如果您在 IE 中打开页面,它将打开 Chrome 并重定向到该站点,如果您在 Chrome 中打开页面,它将直接重定向。
标签: google-chrome redirect internet-explorer-11