简体   繁体   中英

How to disable dialog boxes - alert()?

I have a page where I'm displaying iframes. The iframes are on the same domain with the website so I can edit and read the content of it, but I can't edit the source code of the iframes, because I don't have access to the file itself. The iframes are alerting a message and I want to disable this. I want to disable the dialog boxes at least for myself, I`m using chrome...

Is this possible without disabling javascript? Or could I disable javascript only inside the iframes?

What about:

window.frames[0].alert = function() {};

It overwrites the alert function inside the first iframe with a function that does nothing, hence all alert(...) calls called there result in nothing happening.

As for subsequent iframes, you'd need to change 0 into 1 etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM