I have a page containing an iframe
in which I expect that within the iframe the user will navigate to many different pages - all of them in the same domain as the parent page.
In the top level window I have a persistent object, let's call it appData
. And in the iframe I often have lines like
parent.appData[someProperty] = {a : 1, b : 2};
I'm aware of the general problem of freed script errors and I understand that I shouldn't try to call any arbitrary methods on such an object since the originating document may have unloaded, but surely hasOwnProperty
shouldn't be such a method, and I should be allowed to say, in some subsequent child page:
if (parent.appData[someProperty].hasOwnProperty('a'))
Shouldn't I? And here's what's odd: it works as I expect in every browser I've tested except MSIE 10. I did see the recent answer to IE9 "Can't execute code from freed script" when calling hasOwnProperty() and indeed using in
seems to work fine for my case, but I'm wondering whether I've been "cheating" all along or if this is a bug in MSIE 10.
jsFiddle doesn't handle iframes so I'm not sure how best to demonstrate this with an example, sorry.