Disable the iframe pop-up window to overwrite the parent window. The iframe window

Source: Internet
Author: User

Disable the iframe pop-up window to overwrite the parent window. The iframe window

The iframe function I want is not to control the parent page. If he wants to control it, which code can be added to the parent page to make it unmanageable?
If iframe contains such a statement: window. parent. location. href = "http://www.baidu.com" This will change the page of the parent page,
What can I add to the parent page to make it unable to change the parent page? Some commands are popped up in the new window, instead of overwriting the parent page!

After Baidu is put into the framework, the search will jump to the parent framework, but this tomato search has successfully put him into the framework, but I don't understand how he actually implemented it!

Define in parent window

Var location = new Object () // or var location = "".

If a jsp page is embedded in iframe, a div layer needs to be popped up in iframe, but this div cannot exceed the iframe range.

Ideas:
Define the div layer in the parent window. The pop-up div function is defined as a method popupDiv. On the iframe page, call the method of the parent window:
Window. parent. popupDiv ().

How does the iframe content pop up in the parent window?

I don't really understand what you mean. Do you want a page to be used by others in iframe? If so, you can add the following code to your page:
<Script language = "javascript" type = "text/javascript"> if (top. location! = Self. location) top. location = self. location; </script>
In this way, if the page is placed in the framework, it will automatically jump out of the framework.
If you have any questions, please check your answers.

Related Article

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.