One approach could be to add a random part to the url (i.e.:
/poll?random=f2dee87716f). So, the browser will think of it as a different URL everytime. An alternative approach could be to set the response headers correctly. The HTTP headers that need to be set are as follows:
Expires: Sun, 19 Nov 1978 05:00:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache
Here’s how I do it in TurboGears. To each method that I don’t want IE to cache, I add the strongly_expire decorator, like this:
@expose() @strongly_expire def cant_cache_me(self, position): ...
The code of the decorator, which is responsible to set the headers propertly:
def strongly_expire(func): """Decorator that sends headers that instruct browsers and proxies not to cache. """ def newfunc(*args, **kwargs): cherrypy.response.headers['Expires'] = 'Sun, 19 Nov 1978 05:00:00 GMT' cherrypy.response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0' cherrypy.response.headers['Pragma'] = 'no-cache' return func(*args, **kwargs) return newfunc