Follow us

Saturday, March 5, 2011

Automatically break out of an iframe

Introduction

A concern for webmasters about iframes is that an iframe can be used to include pages on your website into external sites.

How do you prevent pages on your website from being included through an iframe by another website?

Solution

Placing the following javascript code at the master page / top of all pages on your site will ensure that if any other site iframes a page on your website, then your page will break out of the iframe and just display your page in the users browser.



You can download the javascript from here.

Demo

Try including the page( http://db.tt/YMlGXn6 ) through iframe on your webpage.


Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

0 comments: on "Automatically break out of an iframe"

Post a Comment