Flash and Cache

On yet another DL assignment I had to figure out how to get the browser to stop caching my swf’s. I tried using the Adobe/Macromedia Technote method of setting headers to force the refresh of content, but, big surprise, it didnt work.

So I searched for a different method. I needed the page to reload the swf regardless of if it was the latest or not, i wanted it to refresh every.single.time. The solution was simpler than I had expected. By simply appending an arbitrary random number variable onto the swf location the browser will force refresh the swf every time. Here is the code [using the IE activeX bypass]

[script language="javascript" type="text/javascript"]

var randNum = Math.round(100*Math.random());
AC_FL_RunContent(“src”, “myCachedSWF?cacheController=” + randNum);

[/script]