I just ran across what appears to be a nasty bug in Firefox today. Without explaining why I'm doing it, suffice it to say that I just wanted to call a script in a parent frame (from an IFrame) that ultimately results in an XMLHttpRequest. It works in IE 6 and 7, but in FF 1.5, it just doesn't. In fact, the result of the request seemed to be the result of the previous request that was executed, and to make it more interesting, the responseXML returned null while the text showed the results of the previous call.
Oddly enough, no errors were thrown--it acts like a regular call with an error free response; it just doesn't actually seem to perform the request and in the meantime loses its XML document.
Anyways, I was starting to despair when I ran across this blog post. It seems I'm not the only one who's bumped into this one (or some variation), yet I must say it was hard to find that blog entry based on my searching. So I want to raise its visibility with this post.
For me, the solution was simply to use window.top.setTimeout(myfun, 50). That appears to give FF the context it needs to properly execute the request. But of course, that breaks it for IE, so you gotta do a check for Firefox (e.g., if (navigator.userAgent.indexOf('Firefox') != -1)) do the timeout if so; otherwise, make the call directly.
Phwew! Thanks to those who've gone before me!
The opinions expressed herein are solely my own personal opinions, founded or unfounded, rational or not, and you can quote me on that.
Thanks to the good folks at dasBlog!
Copyright © 2015 J. Ambrose Little