HTTP Requests and Browser cache

When you make an HTTP Request, Browser returns the response of the previous call of the same url from cache. We can avoid this by adding a parameter with random value in the request. This will make the Browser take it as a new url and fetch the resource again.

Actionscript

var urlreq:URLReequest = new URLRequest();  
var urlLoader:URLLoader = new URLLoader();

urlreq.data = {random:(Math.random()).toFixed(6)};  
urlLoader.load(urlreq);

Javascript(using jQuery)

 $.ajax({  
     url: url,  
     data: {  
         random:(Math.random()).toFixed(6)  
     }  
});  
Share