WordPress Plugin: Frame Buster

I’ve written my first WordPress plugin. It’s called Frame Buster. This technique is also called a frame breaker or frame busting. It places some JavaScript in the heading of all pages that will prevent the page from appearing in someone else’s frame. This happened to one of my sites a couple of years ago and it was done to steal the site’s content. I did not like it. It should be noted that it will only work if the client browser has JavaScript enabled.

Version History:

  • 0.30 Changed name to avoid confusion with another plugin. (2010-02-18)
  • 0.20 Compatible with WP 2.0. It won’t bust out of the post preview frame. (2005-12-21)
  • 0.10 Initial version

This is the code that it uses:

<script type="text/JavaScript"><!-- 
if (parent.frames.length > 0) top.location.replace(document.location); //–->

Join the Conversation

8 Comments

  1. What if the frame is =0. I don’t know much coding, but if the length refers to width/height the script will not stop 0 size frames, right?

Leave a comment

Your email address will not be published. Required fields are marked *