标签: javascript html alert
我想覆盖网页的警报功能。 以下代码可在控制台上运行。
window.alert = function(msg) { console.log("test succeed"); }
如果我从控制台运行alert(“ test”)命令,则覆盖的警报功能可以工作,但我不想在控制台上工作。我想更改真实网页的警报功能。例如,我想更改https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_alert警报功能。有可能吗?