A
Alan
There is a long-standing bug in Firefox whereby iframes, created by
scripting, display incorrectly cached content on reload
https://bugzilla.mozilla.org/show_bug.cgi?id=279048.
In my case, I have a page containing several iframes, and on load they
sometimes get muddled up (content loaded into wrong frame). Manually
refreshing the frames fixes the problem.
Now, as a workaround I have been adding (or removing) a # to the end
of each iframes src attribute after the frame has been created (thus
causing the frame to update with the correct contents). In jQuery this
looks like:
jQuery('iframe').each(function(i) {
if(/#$/.test(this.src))
this.src = this.src.substr(0, this.src.length - 1);
else
this.src = this.src + '#';
});
Up until now this workaround has solved the problem, however today the
client discovered that when they navigate away from the page and then
hit the back button, the work around does not work.
Eventually I found that adding a delay before applying the workaround
solved the problem, suggesting that there is a race condition between
loading of the cached content and refreshing the frame.
jQuery('iframe').each(function(i) {
var date = new Date();
var curDate = null;
do { curDate = new Date(); } while(curDate - date < 2000);
if(/#$/.test(this.src))
this.src = this.src.substr(0, this.src.length - 1);
else
this.src = this.src + '#';
});
However this is obviously not an acceptable solution. Does anyone have
any alternatives? The client thinks that if Google can do we should be
able to too ... Sigh.
scripting, display incorrectly cached content on reload
https://bugzilla.mozilla.org/show_bug.cgi?id=279048.
In my case, I have a page containing several iframes, and on load they
sometimes get muddled up (content loaded into wrong frame). Manually
refreshing the frames fixes the problem.
Now, as a workaround I have been adding (or removing) a # to the end
of each iframes src attribute after the frame has been created (thus
causing the frame to update with the correct contents). In jQuery this
looks like:
jQuery('iframe').each(function(i) {
if(/#$/.test(this.src))
this.src = this.src.substr(0, this.src.length - 1);
else
this.src = this.src + '#';
});
Up until now this workaround has solved the problem, however today the
client discovered that when they navigate away from the page and then
hit the back button, the work around does not work.
Eventually I found that adding a delay before applying the workaround
solved the problem, suggesting that there is a race condition between
loading of the cached content and refreshing the frame.
jQuery('iframe').each(function(i) {
var date = new Date();
var curDate = null;
do { curDate = new Date(); } while(curDate - date < 2000);
if(/#$/.test(this.src))
this.src = this.src.substr(0, this.src.length - 1);
else
this.src = this.src + '#';
});
However this is obviously not an acceptable solution. Does anyone have
any alternatives? The client thinks that if Google can do we should be
able to too ... Sigh.