Home >Web Front-end >JS Tutorial >How to prevent iframe script pop-up windows from covering the parent window_javascript tips
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 = ""等都可以