Protect iframe from other's and Use One domain for the iframe?
hi i want java scripts for Iframe protection and they work only one site like iframe site url is www.iframe.com and i want to protect on www.my-mainwebsite.com
i just want www.iframe.com work only on www.my-mainwebsite.com when these iframe code use a开发者_如何转开发nother site like www.anothersite.com they will be redirect to www.my-mainwebsite.com
<script type="text/javascript">
if (top !=self || top.location != "www.iframe.com") {
top.location=self.location;
}
</script>
Here is a quick JavaScript code that you can use if you want to make sure that no one should be able to show your website in an IFrame.
Edit1:
- Added second check in if, if site is not equal to "www.iframe.com"
精彩评论