HTML: when entering a site, remove all frames

When a user enters a site for the first time, is there a quick and easy way in HTML to remove all frames that are left over from other websites? As in, someone clicks on a link at (let’s say) Snopes that leads to your index.html and your index.html contains instructions to remove all frames (such as the left frame at Snopes). The only way I know of requires the people at Snopes to put in TARGET="_top" in the A tag. I’m looking for a way to insert the code into my page instead of making someone else add it.

You can test to see if they came from your domain (though I don’t know the code for that off the top of my head, the referrer should be available). If it’s not your site, reload with target=_top.

To the best of my knowledge the tags follow as such this example:


<a href="**newpage.html**" target="_top"><FONT SIZE="1">Break out of<br> someone elses<br>frames here.</FONT></a>

newpage.html meaning the page you want to load in an original frame.

Hope this helps and I hope the vB coding doesn’t get messed up :slight_smile:

Damnit, sorry Euty, Unca and Coldy, didn’t mean for THAT to happen!!! You can wrap it if you need to!

< sigh >

Shoot, the Pit must be draining my brain power.

Mr. Sheephead,

That is the code (ack hope it gets fixed soon) that you insert on your page to break out of frames. The font size and such after the main …target"_top"> is up to you.

< blush >

It’s pretty simple. Add this bit inside your <body> tag:
onLoad="if (self != top) top.location = self.location"

My boss has the sweetest frame remover on earth - she didnt make it with html though…

While the page is being reloaded without the frames it says “frames are evil”

dodgy

<SCRIPT TYPE=“text/javascript” LANGUAGE=JAVASCRIPT>

&lt;!--
if (top.frames.length!=0)
top.location=self.document.location;
// --&gt;

&lt;/SCRIPT&gt;