在全局上下文中停止 window.location 执行
Stop window.location execution in global context
我想在页面加载时停止执行 window.location,如下所示:
<script type="text/javascript">
alert('Bid closed ');
window.location = '/index.html';
</script>
我可以通过在 manifest.json 中的 document_start
期间替换 alert
函数来绕过 alert
消息。但无法阻止 window.location 执行。
window
对象不可写,因此您不能更改 document
和 window
对象
查看此 link 了解更多信息
答案在我看来就像一道数学题。
在注入的脚本中,我刚刚放置了这段代码,它似乎可以工作:
window.alert =
function (msg)
{
throw Error('hello');
}
此异常导致浏览器跳过下一条语句window.location=
我想在页面加载时停止执行 window.location,如下所示:
<script type="text/javascript">
alert('Bid closed ');
window.location = '/index.html';
</script>
我可以通过在 manifest.json 中的 document_start
期间替换 alert
函数来绕过 alert
消息。但无法阻止 window.location 执行。
window
对象不可写,因此您不能更改 document
和 window
对象
查看此 link 了解更多信息
答案在我看来就像一道数学题。
在注入的脚本中,我刚刚放置了这段代码,它似乎可以工作:
window.alert =
function (msg)
{
throw Error('hello');
}
此异常导致浏览器跳过下一条语句window.location=