简体   繁体   English

如何防止iframe页面重定向父页面?

[英]How to prevent iframe page redirect parent page?

If use iframe to handle some webpage.But some of them just redirect my parent page to theirs.I found this code 如果使用iframe处理某些网页,但是其中一些只是将我的父页面重定向到他们的页面,我找到了这段代码

if(self!=top) top.location=self.location; if(self!= top)top.location = self.location;

My question is how to prevent this and make iframe page in my ifrme. 我的问题是如何防止这种情况,并在我的ifrme中制作iframe页面。

No mechanism exists to do what you want to do. 没有机制可以做您想做的事。 It would be an arms race anyway; 无论如何,这将是一场军备竞赛。 if such a technique existed, wouldn't the people who use the code you mention above want to find some way to defeat it? 如果存在这样的技术,那么使用您上面提到的代码的人们是否想找到某种方法来击败它?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM