IE iframe caching bug

Hi,

This is a little bit off topic of TWG but maybe very interesting for people who have iframes on their sites and they don’t get refreshed properly.

I had the problem that after a page refresh of a site with 2 iframes only one of them got updated in IE. The other one was still displaying the old content. After checking the server log files I found out that the 2nd iframe was not called at all. Therefore it was cached in the browser.

I checked my code and was already using the following meta tags in my header section:

<meta http-equiv=”Expires” content=”-1″>
<meta http-equiv=”cache-control” content=”no-cache”>
<meta http-equiv=”Pragma” content=”no-cache”>

I already used Expires = 0 but there was no change either.

Only the combination together with a random number at the request of an iframe where doing the trick.

Below you find my solution how to do this with jsp’s and struts:

<% java.util.HashMap newValues = new java.util.HashMap(); newValues.put(“ts”, System.currentTimeMillis());  pageContext.setAttribute(“timestamp”, newValues); %>

This creates a map ‘timestamp’ with a timestamp in the page context.

And the iframes where then looking like this:

<frameset rows=”60,100″ border=”10″>
<html:frame action=”/action1″ name=”timestamp” frameName=”frame1″  />
<html:frame  action=”/action2″ name=”timestamp” frameName=”frame2″  />
</frameset>

Hope this will help someone 😉

– Michael

Leave a Reply