Breaking out of frames
By: Jool
Learn how to remove other people's frames that they place on your page
Some major indexes like to place their frame on top of your page when your link is clicked on their site. They usually use it for free advertisements, and give a “View this page without this frame” link. But, we don’t necessarily want their frame on our page. Luckily, there is some JavaScript (JavaScript 1.0 to be exact) that we can use to break free from these third party frames on our pages. All we need to do is edit the body tag of our document;
<body onLoad="if(parent.frames.length!=0)top.location='yourpagegoeshere.html';" >
Basically what we are doing is saying if frames are present on the page when it is loaded, then we must reload with yourpagegoeshere.html’s code at the top, effectively stripping any frames from being displayed. You can have this snippet in your body (for this example I’ll use freebie.html as the file name), so freebie.html has the code in it’s body tag, you would then change yourpagegoeshere.html to freebie.html to achieve the desired effect.
Any page with this code snippet will not allow itself to be loaded with another frame on the same page. It will work with any JavaScript 1.0 supporting browser, which basically means it will work with practically any browser anyone still uses these days.
|