views:

369

answers:

0

This is a puzzling one, but I really need to find a solution.

I recently posted a question about getting an "Access denied" JavaScript error when trying to access the document object of an <iframe> that was created with JavaScript (see URL below). This was caused by the document.domain property begin set in the parent document; since the same document.domain would need to be set in the <iframe> for IE to allow cross-frame scripting, but I couldn't set the document.domain because I couldn't access the <iframe>'s document in the first place, this seemed to be a Catch-22.

I did eventually find a solution that appeared to work in every browser I tested in (see the accepted answer and its comments):

http://stackoverflow.com/questions/1886547/access-is-denied-javascript-error-when-trying-to-access-the-document-object-of

The problem is, in Internet Explorer only (I tested in IE 6 but suspect it's every version), this solution works, but when you reload the page (not a hard refresh, just press F5 or click the refresh icon) again causes the "Access denied" error.

Here is a test page that exhibits this behavior:

http://troy.onespot.com/static/access_denied_test_reload.html

You can hard refresh all day, but a "soft" refresh invariably causes the error in IE.

Any ideas about what is going on here? I figure it has to be a peculiarity of IE's reload behavior, but that's just an educated guess and I'm having trouble delving any deeper than that.

Any help would be very much appreciated!