Prohibit all JS scripts such as alert and pop-up windows from the IFRAME page for _javascript tips

Source: Internet
Author: User

Today to do a small software encountered a problem, that is, in a page need to put an IFRAME frame to preview the site, but the site is previewed with a lot of JS script, such as pop-up window, hint box, the most hateful is always let set as the home page and to join the collection, I think there should be a way to prohibit the script in the IFRAME, so Baidu a bit, but also found a lot of new continents, so solve this problem, recorded, convenient later inquiries, but also convenient for everyone to refer to:

<iframe src= "fillseo.html" ></iframe>

Fillseo.html there is a JS script, which has alert, and pop-up windows, very hateful bar, how to prohibit them?
And this fillseo.html is a different domain file.

After looking at countless relevant data, found 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= "height=" id= "Pcyear" ></iframe>
<script>
var fillseo_window=window.frames["Pcyear"];
Fillseo_window.window.alert=function () {
alert ("Pinball!)" ");
Also can write you want to write Dongdong
};
</script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.