Today, I encountered a problem in making a small software. I needed to put an iframe framework in a page to preview the website. However, the website being previewed contains many js scripts, such as pop-up windows and prompt boxes. The most hateful thing is to keep setting it as the homepage and adding it to favorites. I think there should be a way to ban the scripts in the iframe. So I found a lot of new worlds after Baidu. So I solved this problem and recorded it for future query and for everyone to refer to:
<iframe src="fillseo.html"></iframe>
There is a js script in fillseo.html, which includes alert and pop-up windows. It's very abominable. How to ban them?
And this fillseo.html is a file for different domains.
After reviewing countless related information, I found that the following code can completely solve this problem:
Program Code 1:
<noscript><iframe src=fillseo.html></iframe></noscript>
or
Program Code 2:
<iframe src="fillseo.htm" id="Pcyear"></iframe><script>var fillseo_window=window.frames["Pcyear"];fillseo_window.window.alert=function(){alert("bounce!");//You can also write what you want to write};</script>