Reputation: 21
I have been looking for a solution to prevent loading of my site from anywhere other than my site. Meaning can I prevent or at least put measure in place to deter loading of my site in frames and iframes from other sites. I have seen some useful answers here for similar questions but I was wondering about going at it from another direction. Is it possible to onload check browser url if anything other than www.mysite.com/ then force reload of www.mysite.com/ . Can this be done in javascript as my familiarity of other languages is limited. Here is an example of the code I was trying but it isn't working the way I want. It is reloading the iframe only and allowing the the leaching site to remain. I need to force a full page reload to my site. What am I missing?
<script type="text/javascript" language="JavaScript">
<!--
if( -1 == location.href.
toLowerCase().
indexOf('mysite.com') )
{
location.href = 'http://mysite.com';
}
// -->
</script>
Upvotes: 0
Views: 3312
Reputation: 4161
List of FrameBusters available from here and pasted below for future reference.
1.
if (window.top!=window.self){window.top.location="thepage_the_buster_is_on.php";}
2.
if (top.location!= location) {top.location.replace(self.location.href);}
3.
if( window!= window.top ) {top.location.href = location.href;}
4.
if (top.location!= location) {top.location.href = document.location.href;}
5.
if (parent.frames.length > 0) top.location.replace(document.location);
Upvotes: 3