Click to See Complete Forum and Search --> : Reach top object from document in iframe in other domain?


jerkovic
12-11-2006, 07:56 AM
Hi,

I'm having a problem regarding checking if a document is loaded into an IFRAME-object (which it is supposed to) or if it's not. Does anyone know if it is possible to just check if the top object which will be within another domain contains one IFRAME or more? Trying with top.getElementsByTagName("IFRAME").length from the loaded document, and will print out an error page if the document is not loaded in an environment with at least one IFRAME-object. I would of course rather check if it is loaded within an IFRAME, but checking the top objects array of IFRAMES is good enough. The problem is the different domains, and on top of that i cannot use the referrer since it probably will be dynamic.

/Jerkovic

gil davis
12-11-2006, 08:27 AM
Once you load a document from a foreign domain, you lose the security right to javascript access. You won't be able to find out anything from the iframe or from the main page. Sorry.

jerkovic
12-11-2006, 08:44 AM
Bugger! :mad: Thanks anyway :)