Simple JavaScript ‘Frame Busting’ Code

April 16th, 2009 | Save to del.icio.us now(0)

Here is a quick JavaScript  code that you can use if you want to make sure that no one should be able to show your website in an IFrame.

<script type="text/javascript">
if (top !=self) {
   top.location=self.location;
}
</script>

Just put this code in head section of your html page, and it will ensure that your page always get’s displayed outside the frames.

Related posts

  1. Debugging PHP using Xdebug and Notepad++ : Part I
  2. Solution To Session Timing Out Intermittently
  3. Easy File Uploading Solution For PHP
  4. How to remove new folder exe or regsvr exe or autorun inf virus
  5. Simplified AJAX For WordPress Plugin Developers using Jquery

Wondering what to do next?


(Search web development related contents)


3 Responses to “Simple JavaScript ‘Frame Busting’ Code”

  1. April 29, 2009 1:21 pm Bhavya says

    Was looking for this…
    Thx :)

  2. October 21, 2009 4:04 pm Jacob says

    Thanks a lot for the help. This script works awesome.

  3. October 29, 2009 12:26 pm camper hire says

    Thanx this really helps me out…
    **************************
    Jack Brosnan
    camper hire

Trackback URI | Comments RSS

Say Something, and Be Counted

Name (required)

Email (required)

Website

Speak your mind