Tuesday, July 29, 2008

AJAX and Browser Caching Problem

For a long time, I have not been able to understand how to bypass the browser caching problem for developing AJAX applications. Internet Explorer simply looks at the URL, sees whether it has it in the CACHE, and brings up the cached version whenever possible.



The caching problem is observed for HTTP GET requests only. There is no caching issue for HTTP POST requests. It turns out that this is actually very easy to achieve.

A URL is different if it has any of the GET request keys are different. Hence to bypass caching, all one needs to do is add a parameter to the URL which has a new value everytime the URL is accessed, and is not really used by the client/server programs.

For more information see:
http://www.spacebug.com/solving_browser_caching_problem_of_ajax.html

http://www.howtoadvice.com/StopCaching

No comments: