Gossamer Forum
Home : General : Internet Technologies :

More of a Javascript than Perl Question

Quote Reply
More of a Javascript than Perl Question
Hi I know this is a Perl Forum, but was just needing some advice from the programmers out there.

My website uses frames. Unfortunately to date, I am finding my main frame on other peoples websites. I thought at first they were stealing my cfoding, but they are in fact directly linking to it and claiming as theres.

I hate uses banners and unneccessary images where possible to trademark it.

Therefore the question I have and I have seen it done before using javascript. How can I make it so that if my frames are used outwith my main frame they are sent to my homepage.

Basically if frame = _top then homepage but if frame = _self or whatever allow content.

As said before I know its only a few lines of code in my head tags, but like always you think thats a good idea and never bookmark it or take any note until you need it.

Thanx all, and if this is an inappripriate posting (Perl Forum) please delete, as I understand.

Stuart
Quote Reply
Re: [stu2000] More of a Javascript than Perl Question In reply to
Hi all, I found the code that will do the job:-
Code:
<script language="JavaScript" type="text/javascript">
<!-- Hide script from older browsers
var url = "http://www.mywebsite.com/";
frameEnforcer("y");
function frameEnforcer(frames) {
if (frames == 'y'){
if (self.parent.frames.length == 0){
self.parent.location = url;
}
}
else if (frames == 'n'){
if (self.parent.frames.length != 0){
self.parent.location=url;
}
}
}
// end hiding contents -->
</script>

Last edited by:

stu2000: Oct 5, 2002, 12:34 AM