Iframes problem in Safari & Chrome
I have domain A that opens an IFRAME with domai开发者_Python百科n B, which opens IFRAME with domain A in order to access the parent.parent.
I am able to do JS functions from A, except for SAFARI & Chrome.
I have the Iframe DOM element, and I do iframe.contentWindow.location but it doesn't give me the right domain! (gives me domain B)
What can I DO? thanks
That's just because you do contentWindow for iframe from domain B. To get A you should do smth like document.getElemenetsByTagName('iframe')[0].contentDocument.getElemenetsByTagName('iframe')[0].contentWindow.location
(note that I didn't test it)
Problem was, that the iframe needed to be opened in runtime and not in the HTML. (the iframe + the src in runtime)
精彩评论