Javascript Question

DeadlyDrew

Junior Member
Mar 6, 2001
6
0
0
This is a frames page question.
The following code tells the browser that if this individual frame page is not loaded within a frame then it is to be redirected to said website. What this prevents is your framed pages getting loaded to _top.

<script>
if (parent.location.href == self.location.href){
// change the url below to the url of the
// frameset page...
window.location.href = 'http://www.boredtechs.com'
}
</script>


My question is. I need code that works the other way around. If my page gets loaded in to a frame I want it to automatically jump to _top. Meaning burst out of the frame and load full browser. This is to prevent a page being loaded in to a frame.
Thanks in advance...
 

FMJGomerPyle

Senior member
Feb 8, 2001
246
0
0
this should do it:

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!--

if (window != top) top.location.href = location.href;

// -->
</SCRIPT>