Category Archives: Flash

Flash Caching Issue on IE

I had a problem with a client of a client whereby they had a flash gallery component called simpleviewer on the site.  Basically depending on the page the browser viewed, the component would load up a dynamic xml file and present a different slideshow on each page.

The problem happened when users have caching turned to automatic.

I tried various things like, setting the various meta tags for browser caching in the head section of the html document

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">

I tried setting this in the footer also because of IEs caching problem.

I then tried setting this sort of stuff on the server through php headers even setting the last modified date:

header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");

I then tried setting parameters on the .swf file itself hoping that it would see it as a new request for a different swf file each time (where contentid is the id of the page loading).

var fo = new SWFObject("viewer.swf?unique=<?php echo $contentid ?>",
"viewer", "640", "380", "8", "#ffffff");

In the end i figured out that the flash file itself was caching the xml document that it was loading  so this had to be different for each page request (I had been using cookies to store the currently selected page). 

"gallery.php?contentid=<?php echo $contentid ?>");

And low and behold, problem solved.

Talk about beating about the bush!

Anyway, hope this helps someone else out there.