Don't Get Framed

Frames allow you to combine different web pages together into one window, even if all of those pages aren't yours and weren't intended to be framed. If you don't want your page to be framed, put this little Javascript in the page:

this code produces this
<SCRIPT TYPE="text/javascript">
<!--
if (top != self)
top.location=self.document.location;
//-->
</SCRIPT>
this page

This script checks to see if the current page is the "top" page. If it is not, it tells the web browser to load the current web page as the top, thus wiping out any frames. Of course, this script won't work with browsers that don't understand scripting, or where scripting is turned off, but the script will work on most browsers, and that makes it a pretty effective deterrent.





About the Author
Copyright 1997-2002 Idocs Inc. Content in this guide is offered freely to the public under the terms of the Open Content License and the Open Publication License. Contents may be redistributed or republished freely under these terms so long as credit to the original creator and contributors is maintained.