Prevent Your Web Site From Being Framed

Submitted by:Jhon Brain

Date added:26 September, 2011

Category:JavaScript

If you've ever discovered that someone has linked to your web site within a frame, which means your site is stuck in their frame with their information displaying within another frame, you know how frustrating this can be. You want your visitors to visit your web site within their standard browser window - not within another web site's frame. The following JavaScript code will enable you to prevent your web site from being framed.

Add the following code to your <body> tag:

Tags: prevent frame

Code Snippet:

<body onLoad="if (self != top) top.location = self.location">
 
 

Comments