Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

does anyone know of a handy pice of

Status
Not open for further replies.

ckennerdale

Programmer
Dec 23, 2000
158
0
0
GB
does anyone know of a handy pice of code, which you place in the header of each page withiin a frameset that re-directs the user to the main page if they have come to one of the pages within the frame set and not the frame set itself? Caspar Kennerdale
Senior Media Developer
 
Ok maybe I'm not that lazy. I saw the amount of copyright you had to download and was appaled. Copyrighting simple overly complicated script is dumb. Make a script accessible to all by making it simple is better.

function removeFrames()
{
if (parent.frames.length != 0)
{
window.top.location.href = "myPage.html"; // change URL
}
}

call in the body onload="removeFrames()" or anywhere that your script executes at start.

Hope this helps. I'm hungry... need food.... Gary Haran
 
How about:
Code:
if ( top.location == self.location )
   top.location.href = "yourFrameSet.html";
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
tsdragon's soloution followed the law of k.i.s.s., if you know what I mean. although both work, you would want to use the tsdragon's location tester when using a frameset of your own, testing to see if your frameset was opened in another frameset. (does that make sense??)

Robert Carpenter
questions? comments? thanks? email me!
linkemapx@hotmail.com
Icq: 124408594
online.dll

AIM & MSN: robacarp
 
That's not actually MY code. It was one of the first pieces of code I learned from a javascript book I read a couple of years ago. It's still useful. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Well, you provided it. :) as I have said many times, proving a copyright notice on a piece of code is difficult, since the only thing that the programmer chosses what to write is the variable names, and I have a handy little tool in my text editor that will search out and replace any text string...so, whose code really is THEIR code? Robert Carpenter
questions? comments? thanks? email me!
linkemapx@hotmail.com
Icq: 124408594
online.dll

AIM & MSN: robacarp
 
if (parent.location.href == self.location.href) {
window.location.href = your_frame_keeper_url;
}

or this
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top