frame-buster_en
Tired of sneaky websites trying to hijack your content with frames?
Then add this your pages and bid them farewell. This function will make any page that has been wrapped with a parent frame bust or break out of it. It also works on iFrames.
But what if you use frames of iframes on your own site?
You'll notice that there is a try{ } statement. Simply add a variable named "friend" to the parent frame, and the try{} statement will test for it, and not break your own frames.
It has been tested on:
- FireFox
- Internet Explorer
- Opera
// Escape from frame, but retain one-click "Back". -->
if (top != self) {
try {
if (top.friend) {parent.friend = true;}
else frameBust();
}
catch (err) {
frameBust();
}
}
function frameBust() {
if (document.images) top.location.replace(document.location);
else top.location = self.location ;
}


















