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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

frameset only for own doamin

Status
Not open for further replies.

laserbbs

Programmer
Aug 27, 2006
4
DE
I have been looking for a simple way to have a frameset (actually a framebreaker) which only allows a given host or IP to be able to use the frameset.

I have tried this method.
Code:
<script language="javascript" type="text/javascript">
<!--
if (top.frames.length > 0 )
if (top.location.host != top.location.hostname)
top.location=self.document.location
//-->
</script>
but I am getting an error on Internet explorer.

Please help
 
you need curly brackets.

Code:
if (top.frames.length > 0 ) {
    // curly braces for the following if-statement are optional
    if (top.location.host != top.location.hostname) {
        top.location=self.document.location
    }
}



*cLFlaVA
----------------------------
[tt]mr. pibb + red vines = crazy delicious![/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Thank You for your quick responsed.

but I still having the same problem..
see it here
 
Thank You!!

I change the code to this..
Code:
if (top.frames.length > 0 ) {
    if (window.location.host != window.location.hostname) {
        top.location=self.document.location
    }
}

It doesn't shows any errors,
 
Hmmm....
It's not working...
It still allows other to have it on their frames
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top