Avg. Rating 1.0

Problem

Many browsers use cache for quick file loading, but sometimes you want the most recent data to be available. To do this, we must clear the cache.

Solution

When loading a file, whether they are XML, SWF, or image files, we can use ?cache =new Date().getTime to clear the cache and ensure the most recent files are available.

Detailed explanation

Many browsers use cache for quick file loading, but sometimes you want the most recent data to be available.  To do this, we must delete the cache.

When loading a file, whether they are XML, SWF, or image files, we can use ?cache =new Date().getTime to clear the cache.

For example:

var load:URLLoader = new URLLoader();
load.load(new URLRequest("data.xml" + "?cache=" + new Date().getTime()));

or

var load:Loader = new Loader();
load.load(new URLRequest("atf.jpg" + "?cache=" + new Date().getTime()));

 

Source from: http://activetofocus.com/blog/how-to-load-the-latest-xml-file-to-solve-the-cache-problem-18/


+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes