tags:

views:

243

answers:

2

I know about iframes from different domains unable to access pretty much anything on the parent level, BUT, all I would need to know is the top-most domain. Here is the scenario:

ABC.com loads an iframe from DEF.com that loads an iframe from XYZ.com. On the level of XYZ.com I need to know that ABC.com is the top most domain.

Any thoughts? Assuming top and intermediaries cooperation or without cooperation, are there any hacks for different browsers or?

I have been able to come up with several different ways to do this kind of thing on Firefox, but I'd be interested to see this exploited for IE in some way.

A: 

I can't remember if the same-origin-policy prevents reading of the location or not (obviously, writing or modifiction is out). But you can test it very easily.

From a page on XYZ.com

alert( top.location.href );
Peter Bailey
That would get you a permission denied on FF and access denied on IE...
fixanoid
A: 

Peter is right.. just one little change, since u want the domain not the full url top.location.host - gives the port with the name or top.location.hotname - just domain name

NetRoY
I'm afraid this doesnt work either. You get permission denied on IE, I will try this with other browsers, but given that this is a "legal" method, I've scanned this over before and it doesnt work in the scenario outlined above.
fixanoid