在全局上下文中停止窗口位置执行



我想在页面加载时停止执行window.location,如下所示:

<script type="text/javascript">
alert('Bid closed ');
window.location = '/index.html';
</script>

我能够通过在 manifest.json 中document_start期间替换alert函数来绕过alert消息。但无法阻止窗口位置执行。

window对象不可写,因此无法更改documentwindow对象查看此链接以获取更多信息

在我看来,答案就像一个数学难题。

在注入的脚本中,我刚刚放置了这段代码,它似乎可以工作:

window.alert =
                function (msg)
                    {
                       throw Error('hello');
                    }

此异常导致浏览器跳过下一条语句window.location=

最新更新