Dealing with browser caching URLs

Recently I encountered a situation in which the XML feed was being cached by the browser. Thus when the XML feed was updated my app was failing to reflect the changes.

I decided that I would pass a random foo variable over the URL string to encourage the browser to refresh. In order to do this I wanted to use a GUID (or a close approximation of the concept). A GUID for those who do not know is a reference term for “Guaranted Unique IDentifier”. Though truthfully, like most guarantee’s, it carries little weight. That said…it is fairly unlikely to generate a duplicate GUID in limited use.

In order to generate the GUID you must import the following class package:

import mx.utils.UIDUtil;

After that you simply call the class and method as seen below:

“myXMLFeed.xml?foo=” + UIDUtil.createUID();

Note, in the above example I am merely appending the returned GUID value to the end of my XML feed as the value to my parameter “foo”.

Hope you find this little bit helpful.

- The Saj

1 Response to “Dealing with browser caching URLs”


  1. 1 Jim September 14, 2007 at 4:58 pm

    This is a nice solution, and one I haven’t thought of before. Other methods that seem to work are Math.random() and new Date().getTime().

Leave a Reply