繁体   English   中英

保护iframe与他人隔离,并为iframe使用一个域?

[英]Protect iframe from other's and Use One domain for the iframe?

嗨,我想要Java脚本来保护iframe,它们只能像iframe网站url这样的一个网站是www.iframe.com ,我想在www.my-mainwebsite.com上进行保护

当这些iframe代码使用其他网站(例如www.anothersite.com)时,我只希望www.iframe.com仅在www.my-mainwebsite.com上工作,它们将被重定向到www.my-mainwebsite.com

<script type="text/javascript">
if (top !=self || top.location != "www.iframe.com") {
   top.location=self.location;
}
</script>

如果要确保没有人能够在IFrame中显示您的网站,可以使用以下快速JavaScript代码。

编辑1:

  • 如果站点不等于“ www.iframe.com”,则添加了第二次签入

暂无
暂无

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

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