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

using top.location.hostname to detect frameset

Status
Not open for further replies.

KABUSA

Technical User
Mar 9, 2004
17
US
Hi,
I have a website that uses a frameset to control its shopping cart. If my site is accesessed from some other site with a frameset, like some web search engines, My site is prevented from setting up it's own frameset.
So It seemed like a good idea to compare hostnames. That would tell you that the top frame is from somewhere else.
But I am finding that I cannot detect this information using top.location.hostname. It comes back blank. Is that some sort of security block?

any help would be appreciated.

Kevin
 
Hi,
thanks for responding.
if you add an alert tag with top.location in it, it will not display! If you put self.location in it, it displays the lower frame(which is my website domain.)

The problem is the top frame is created by the search engine so it has a different domain or hostname.
You cannot load something into the top frame(as you suggest) at this point because it is a different domain. That would be a security breach.
But I would have thought you could still retrieve that hostname. It is right in the browser address line!

Kevin
 
Did you try the code I gave? IMHO, it would work because if you can't retrive the address (because of security restrictions), then it will not equal your address, and so should set it.

Of course alerts won't work - but you didn't state that to be a requirement.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Hi,
Yes I did.
since I was unable to access any info about the top frame, the solution then was to look for the name of the bottom frame. My frameset page names the bottom frame "bottom";
so if it has that name, I know my frameset is "set".
if it doesn't, then I know I need to call the frameset page.
works very well.

Kevin
nov 29, 2006
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top