Simple JavaScript ‘Frame Busting’ Code

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: