javascript:window.document.bgColor="green";
history.go(0)
javascript:history.go(window.document.bgColor="green")
javascript:history.go(window.document.bgColor="green")
javascript:history.go(tags.H1.fontStyle="italic");
An important JavaScript for frames users.
The following should be placed in the head of all of your framed pages, it will force the page to load in it's intended frame. Some search engines do not recognize frames and will list each page individually, this code will ignore the link to the individual page and load the page in the frame as you intended it to, be sure to change the "frameset name" to your frameset.
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--Hide script from old browsers
/*This script has been written by Harvillo http://members.aol.com/harvillo for your use
please leave this intact.
*/
if(top.location==self.location){
top.location.href="frameset name.html"
}
//end hiding script from old browsers-->
</SCRIPT>
I was struck by how many different ways authors had come up with to detect that frames were being used on the current page. All of the following JavaScript conditional expressions will test to see if frames are in use:
if (self.location != top.location)
This tests to see if the document location of the current document matches the location of the top-most document on the page. If frames are being used, that top-most document will have a different URL and the test will succeed. If there are no frames, the top document and the current document are the same object and have the same location URL, indicating that frames are not being used.
if (self != top)
This is a more general version of the first condition. Instead of testing the document location, simply check to see if the current document is the same object as the top document on the page. If not, frames are being used.
if (top.frames.length > 0)
The top document has an object that contains all the frames in use on the page. Within that object, the length member keeps a count of how many frames are currently defined. If that count is greater than zero, frames are being used. It is also possible (and more elegant) to write this condition simply as top.frame.length. Since any non-zero value in JavaScript (like C) is equal to "true", a non-zero frame count returns a true value as well.
if (top.frames[0].name != "name")
This is a more specific test that only works if your page contains its own frames. In that case, you can test the name of a specific frame to see if it matches that frame in your document. You'll need to replace the 0 in the condition with the number of a suitable named frame in your document, and replace the "name" with the name of the frame. If the names don't match, your frames have been captured within another set of frames.
Once you detect that they are in use, breaking free is easy. Simply set top.location to your document's URL. When this property is changed, the browser will reload the document into the top-level browser display, removing all the frames and replacing them with your document.
Readers were split in setting top.location, relying on two principal methods:
top.location = "URL";
top.location = self.location;
The first sets the location to an explicit URL which you must provide. The second uses the URL of the current page. I prefer the second method, since you need not ever update the URL if the page moves or changes its name. The first version will require ongoing maintenance as your site grows and evolves.
The last piece to the puzzle is adding this snippet of code to your documents. We put this down with the onLoad attribute of the <BODY> tag. The JavaScript fragment assigned to this attribute is executed as the page is initially loaded by the browser. This means that the page can detect the presence of frames almost immediately, before your page is fully presented to the user. Since a change to the top.location property results in an immediate reload, you'll break free of the frames almost instantly.
Collecting all my favorite pieces of the puzzle, I offer this version of the <body> tag to frame-proof your pages:
<body onLoad="if (self != top) top.location = self.location">
Add all the other attributes to it, of course, and give it a try in your pages. If it doesn't work, I'm sure to hear about it.