How to access parent window variables from object

Posted by Pickle on Stack Overflow See other posts from Stack Overflow or by Pickle
Published on 2010-05-11T21:32:41Z Indexed on 2010/05/11 21:34 UTC
Read the original article Hit count: 211

I've got an XHTML 1.1 Strict document that is loading another XHTML 1.1 document in an <object> element (as <iframe> isn't part of the XHTML 1.1 spec). I'm having trouble in IE8 (don't care about 6 or 7) with accessing a javascript variable, Lightbox, in the parent window, from the document loaded in the <object>.

In Firefox and everywhere I've seen online, I can just use window.parent.Lightbox. In IE8 however, I get it being undefined. window.parent does give me an object but it doesn't have my Lightbox variable. I've also tried window.Lightbox, window.top.Lightbox, and window.top.document.Lightbox, but all return undefined.

I should mention I'm using Javascript to set the data property of the <object> - but I don't see how that could affect anything relevant.

What Javascript Fu do I need to do to be able to access my Lightbox variable?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about internet-explorer