Prevent Framing of Your Web Site With JavaScript


I found a nice tip on about removing the top frame when other sites try to frame your Web site in a frame. Some common examples are Google Images and

Here is the code to prevent other Web sites from showing your site inside of a frame:

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

Paste the above code just after the opening <body> tag. If your site is loaded in a frame the JavaScript code will redirect to your site without the frame.

Syndicate content