window.history.pushState 是否绑定到 Internet Explorer 11 中的 ActiveX?
Is window.history.pushState tied to ActiveX in Internet Explorer 11?
当尝试使用 window.history.pushState 附加到 URL 时,我在 Chrome、Firefox、Safari 和 Opera 中实现了功能,但在我的虚拟机中,弹出了一个浏览器对话选项在 IE 中要求启用 ActiveX。如果这样做,我将获得所需的功能,但如果没有,消息最终将消失,并且必须重新打开浏览器。有没有不用ActiveX
实现的方法
<button onclick="myFunc()">Button</button>
...
<script>
var myFunc = function() {
var newurl = window.location.protocol + '//' + window.location.host + window.location.pathname + '?append+to+the+url';
window.history.pushState({ path: newurl }, '', newurl);
}
</script>
我希望它立即附加到 URL,但 IE 希望用户启用 ActiveX 以使其保持功能。
我在我这边进行了测试,根据我的测试结果,我也得到了弹出窗口以允许 ActiveX 使代码工作。
在进一步测试中,我发现启用 ActiveX 的选项也无助于解决问题。
之后,我尝试在 高级选项卡 中启用名为 Allow active content to 运行 in files on My Computer 的选项] 的 Internet 选项。
它解决了 IE 的问题,现在没有任何允许 ActiveX 的弹出窗口,代码运行正常。
在 IE 11 中的输出:
当尝试使用 window.history.pushState 附加到 URL 时,我在 Chrome、Firefox、Safari 和 Opera 中实现了功能,但在我的虚拟机中,弹出了一个浏览器对话选项在 IE 中要求启用 ActiveX。如果这样做,我将获得所需的功能,但如果没有,消息最终将消失,并且必须重新打开浏览器。有没有不用ActiveX
实现的方法 <button onclick="myFunc()">Button</button>
...
<script>
var myFunc = function() {
var newurl = window.location.protocol + '//' + window.location.host + window.location.pathname + '?append+to+the+url';
window.history.pushState({ path: newurl }, '', newurl);
}
</script>
我希望它立即附加到 URL,但 IE 希望用户启用 ActiveX 以使其保持功能。
我在我这边进行了测试,根据我的测试结果,我也得到了弹出窗口以允许 ActiveX 使代码工作。
在进一步测试中,我发现启用 ActiveX 的选项也无助于解决问题。
之后,我尝试在 高级选项卡 中启用名为 Allow active content to 运行 in files on My Computer 的选项] 的 Internet 选项。
它解决了 IE 的问题,现在没有任何允许 ActiveX 的弹出窗口,代码运行正常。
在 IE 11 中的输出: