我可以通过Google Chrome扩展程序阻止提醒()吗? [英] Can I prevent an alert() with a Google Chrome Extension
本文介绍了我可以通过Google Chrome扩展程序阻止提醒()吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以创建一个Google Chrome扩展程序来阻止页面执行 alert()
?
Can I create a Google chrome extension to prevent the page from doing an alert()
?
推荐答案
谢谢。这有帮助。然而,我意识到我需要这样做才能使它工作。
Thank you. That helped. However, I realized I needed to do this to get it to work
location.href="javascript: window.alert = function(x) {console.log(x)};"
如果我想删除警报并确认,我可以这样做
if I wanted to remove alerts and confirms, I can do
location.href="javascript: window.alert = function(x) {console.log(x)}; window.confirm = function(){return true;};";
这篇关于我可以通过Google Chrome扩展程序阻止提醒()吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文