Friday, 25 January 2013

Clearing the cache automatically for every new deployment

UPDATE: It turns out in Firefox my SWFs start being cached after directly midnight. Once I manually clear the cache I don’t have to clear it for a while.

So you’re working on a project and you go to check it in the browser and hit refresh. You test it again and the same problem exists. But wait! Are you looking at the SWF you just compiled or a cached SWF!??!?! There have been so many times I’ve been working on a problem and didn’t realize the SWF was cached in the browser. What if there was a way to tell if you are looking at a cached SWF or a newly compiled SWF? Well NOW YOU CAN!

Taking Igor and Paul’s work a bit further I created a class you can drop into your project with one line of code, that will tell you the compilation date of your swf, if the swf is being viewed for the first time or if it is cached and a version number you can use for testing. It also provides a reload button handler.

Here is a live demo.
 
Here is the project download





No comments:

Post a Comment