How to get around caching problems with XMLHttpRequest

I was writing a greasemonkey script which is using XMLHttpRequest to get a page, then post something and again get to see if the change was made. However, Opera (and presumabley firefox as well) caches the result of a get through XMLHttpRequest so the test was returning a false negative. Searching for a workarounf, I found ths site: http://www.isolani.co.uk/blog/atom/JavascriptAtomApiClientUsingXmlHttpRequest
from which I quote the idea
[quote:366a41af29]
I’ve worked around this by inserting a timestamp in the query string of every get request – that way it forces IE to ignore the cache.
[/quote:366a41af29]

it works 🙂

Related posts

Leave a Reply

This blog is kept spam free by WP-SpamFree.