PDA

View Full Version : Need to create a preloader that forces a reload from the server, and not the cache



0L4F
April 30th, 2009, 07:33 AM
Hello fellow Kirupians,

This is something I've been struggling with for some time, but now I urgently need to come up with a solution for a new project: I need to create a preloader that forces a reload of the Main.swf from the server, and not from the user's cache.

This is because the site (for a big music festival) will get frequent updates, and users will visit more than once.

I have my HTML-metatags set up like this:


<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

<meta http-equiv="Expires" content ="0" />

<meta http-equiv="Pragma" content ="no-cache" />...but these get kind of, uhm, ignored?

So now I'm looking for a solution in my AS3 preloader.
I've tried this trick, that works fine with xml-files, but with swf's it doesn't seem to work:


l.load(new URLRequest("Main.swf" + new Date().getTime()));Is there any solution out there?

flashm
April 30th, 2009, 09:14 AM
i don't know whether this will help you, but chek it ;)

http://www.blog.lessrain.com/flash-loading-and-browser-cache-test-suite/

cshaheen
April 30th, 2009, 03:20 PM
fixed:


load(new URLRequest("Main.swf?dontcacheme=" + Math.random()*1000000);

0L4F
May 1st, 2009, 03:08 AM
Hey flashm, thanks for that link, some very useful info there...

And cshaheen: FIXED indeed!

I can't believe I overlooked the missing "?" in my code after staring at that line for so long, because

ActionScript Code:

l.load(new URLRequest("Main.swf?" + new Date().getTime()));




also works fine...

Thanks!!!