Home >Web Front-end >JS Tutorial >How to prevent iframe script pop-up windows from covering the parent window_javascript tips

How to prevent iframe script pop-up windows from covering the parent window_javascript tips

WBOY
WBOYOriginal
2016-05-16 16:37:021447browse

The iframe function I hope is not to control the parent page. If he wants to control it, how can he add any code to the parent page so that he cannot control it?
If there is such a statement in the iframe: window.parent.location.href="http://www.baidu.com", this will change the web page of the parent page,
What should I add to the parent page so that it cannot change the parent page? A command will pop up in a new window instead of overwriting the parent page!

After Baidu is put into the frame, using search will jump to the parent frame, but this tomato search successfully put it into the frame, but I don’t understand how it was achieved!

Defined in the parent window

var location = new Object()
//或者var location = ""等都可以
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn