JS to escape frames (was Homework Central)

Paul Corr paul.corr at drexel.edu
Mon Sep 27 16:59:40 EDT 1999


Roy, et. al,

I've used this:

The following JS snippet, placed in a page, will force a new window 
if someone has placed your page within a frame on their site:

<SCRIPT LANGUAGE="JavaScript">
<!--
if(window.self != window.top)
	open("http://www.yoururl.com/", "_top");
// -->
</SCRIPT>


At 1:52 PM -0700 9/27/99, Roy Tennant wrote:
>It has come to my attention that Homework Central is "framing" all sites
>to which it points. I've asked them to cease and desist from framing our
>sites, but so far they have not complied. Therefore, I am using the
>following scrap of Javascript to break out of their frame:
>
><Script Language="JavaScript">
><!--
>setTimeout ("changePage()", 0);
>function changePage() {
>if (self.parent.frames.length != 0)
>self.parent.location= "index.html";
>}
>// -->
></script>
>
>(Where "index.html" is the name of the file in which it is placed). I hate
>being forced to do this, so if anyone has any other ideas, I'm all ears.
>By the way, you should go check it out. So far I've found pointers to
>Stanford Univ. Library pages, as well as pointers to sites at Harvard,
>Univ. of Virginia, Univ. of Michigan...
>Roy Tennant



More information about the Web4lib mailing list