


Disable all js scripts on iframe pages such as alerts and pop-up windows_javascript skills
May 16, 2016 pm 04:37 PMI encountered a problem when making a small software today, that is, I need to put an iframe in a page to preview the website, but the previewed website contains a lot of js scripts, such as pop-up windows and prompt boxes. The most disgusting thing is I kept setting it as homepage and adding it to favorites. I thought there should be a way to ban scripts in iframes, so I searched on Baidu and found a lot of new continents. So I solved the problem and recorded it for future inquiries and for everyone’s reference:
<iframe src="fillseo.html"></iframe>
There is a js script in fillseo.html, which contains alerts and pop-up windows. It’s disgusting, how can I disable them?
And this fillseo.html is a file in a different domain.
After reviewing countless relevant information, I found that the following code can completely solve this problem:
Program code one:
<noscript><iframe src=fillseo.html></iframe></noscript>
or
Program code two:
<iframe src="fillseo.htm" width="200" height="200" id="Pcyear"></iframe> <script> var fillseo_window=window.frames["Pcyear"]; fillseo_window.window.alert=function(){ alert("弹弹弹!"); //也可以写你想写的东东 }; </script>

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

What should I do if there are no pop-up reminders for calendar events in Win10? How to recover if calendar event reminders are gone in Win10

Edge browser js script disabling method

How to use Vue to implement pop-up window effects

What are the loading events of iframe?
