| WordPress Affiliate Pro Review »

How to Break Out of HTML Frames

By Dewald Pretorius | September 22, 2007

The Problem

It happens frequently that other sites include your web site in a frame. Think of when someone clicks through from an image search on Google, or a translation of your site on Google or BabelFish.

Other web sites could frame your site with more sinister intentions, such as using your content to lend an air of credibility to their spam (or even illegal stuff) that they include around the frame that contains your site.

No site has a real pressing and legitimate reason to frame another site.

The Solution

It’s really easy to prevent your site from being framed by another site.

In the HTML ‘<head></head>’ section, insert the following Javascript code. If someone tries to include your site in a frame, the code will automatically break out of the frame and open your site in the browser window, free of the frame.

<script type=”text/javascript”>
<!–
if (parent.frames.length > 0) parent.location.href = location.href;
–>
</script>

If you’re running a WordPress blog, the easiest solution is to download and install this WordPress plugin.

Tags: Building Websites, Tools

Topics: Tools, Building Websites |

Other Posts That May Interest You

Comments

August 27, 2008

Join the Private Club

Search

Blog Topics

Review Topics