Old Articles - 6 years, 6 months ago - 0 Comments
Stop Browser Caching Data
Are you sick of your browser caching loaded variables? are you sick of loaded movies being cached? Then heres how to stop the browser from caching your data…
The browsers cache comes in handy for slow connections, all the requests you make to a webserver are stored in a local folder on your computer, so that the next time you make the same request, the file can be loaded from the local hardrive as opposed to having to download the data over the internet again.
However this can cause problems when you are building web based applications, you need to be sure, as the developer, that the latest content is being viewed.
To achieve this in your Macromedia Flash Movies is relativley straight forward, all you need to know is the way the browser cache works.
The browser cache, stores the ‘full’ url, along with the data associated with that url as a local file when a request is made to a webserver and the data is completley downloaded.
If that same request is made again, to the webserver, then your browser uses the local version stored previously, unless you have changed the default browser settings.
So for example, if i was to do a loadVariables call to a specific url, the data for that load variables call is cached when it has been fully downloaded, the next time i do the same load variables call, the browser returns the data it stored previously.
To stop this from occurring, all you need to do, is make sure that the url you are making a request to, is unqiue, each and everytime. To make the url unique each and everytime without moving the data around, or changing any filenames, you simply have to ‘append’ a unique value to the url of the request as a name/value pair.
So for example, to stop the following load variables call from caching in the users browser:
this.loadVariables('http://www.flashguru.co.uk/myscript.php');
We simply append a ‘unique’ value to the url:
unique=new Date().getTime() //will always be unique
this.loadVariables('http://www.flashguru.co.uk/myscript.php?unique='+unique);
The above request will be stored in the users cache but the same request will ‘never’ be made again, therefore the data the browser has stored in the cache will never be displayed/retrieved.
The same process is used to stop loaded movies caching.
Note: This is an old article!
Please be aware that the content of this article may no longer be accurate and the links contained within could be broken.
Update Notifications
You can add our RSS feed to your favorite feed reader or recieve an email when a new article is posted by entering your email address below.
FLASH EXPERTS
- Andre Michelle
- Aral Balkan
- Big Spaceship
- Chafic Kazoun
- Colin Moock
- Craig Swann
- Erik Natzke
- Grant Skinner
- Jesse Warden
- John Grden
- Keith Peters
- Lee Brimelow
- Lord Alex
- Mario Kingemann
- Matt Voermn
- Ralph Hauwert
- Richard Leggett
- Trevor McCauley
FLASH COMPONENTS
- AFComponents
- Components Network
- Extend Studio
- Flash Relief
- Flash Store
- Flashden
- Flashloaded
- Ghostwire
- Image Vue
- Jumpeye
- Page Flip Component
- Slideshowpro
FLASH VIDEO
- Akamai
- FFMPEG
- FlashComGuru
- Flashstreamworks
- FLV Player
- FLVMDI
- flvPlayerPro
- FLVTool2
- Influxis
- JW FLV Player
- Vital Stream
FLASH RESOURCES
- Actionscript.org
- Adobe Labs
- Developer Center
- Flash Interface
- Flash Player Statistics
- Flashkit
- Kirupa
- MDM Zinc
- OSFlash
- PaperVision3D
- SWXFormat
- Tweener
SPONSORS
More In Actionscript
- Adobe MAKE SOME NOISE
- Undocumented Actionscript 3
- BitmapData.loadBitmap gone in AS3
- Actionscript 3 - New Capabilities
- Flash 8 - setTimeout

