tags:

views:

531

answers:

2

Hi, i have an swf file, uploaded in server. But whenever I make changes to the files, uploaded and replace the old one, I go to browser, clear cache and everything, refresh the page, but it still load the old swf file. (Do you know what I mean?)

But after 10 - 20 hours, I visited the page again, it loaded the new one.

Is there anyway to load the new swf without having to wait for 10 - 20 hours?

(my last option is renaming the swf, which works immediately. But for some reason, renaming is my very last option, I would like to know if there are anything I can do before I rename the file.)

Here are the list of what I tried to do to load new swf:

  1. Clear browser cache

  2. Clear dns cache (ipconfig /flushdns)

  3. Include header in html meta pragma no-cache (forgot the formula, cuz i copied from internet)

  4. Rename the swf (which works immediately)

A: 

See http://forums.adobe.com/thread/26247

marcc
A: 

Looks like you need to add some extra stuff to the URL that points to the SWF. Write a function like this (PHP)...

<?php

    function swfURL($url2swf){
        return $url2swf . "?random_number=" . rand(1,9999);
    }

?>

Or do something similar with javascript. The random number on the end of the url will be ignored, but it will make whatever is caching the result think it's loading something new.

gargantaun
it's way better to append the timestamp of the swf's upload instead of a random number. if you choose the random approach you will get a new swf *every* time and that's a bit overkill.
grapefrukt
nah, a random number is the way to go, because it's the only way to ensure you PULL the newest version of a file. if you append the timestamp, then you have the SAME problem as before... downloading the SAME file, even though the file has changed
Triynko