How to stop chrome from caching

I need to force the browser to reload the previous page from the server when the user presses the back button.

I've added the following to my response headers:

Cache-Control: no-cache, must-revalidate
Expires: -1

This seems to work for most browsers but not for Google Chrome that insists on returning the cached results.

So does anyone know how I force the browser to get the page from the server when the user presses the back button?

Thank you.

Answers


as per this bug report in chromium repo, users find that using no-store instead of no-cache will fix it in chrome.


This is not proper, but perhaps you could use the Javascript history object to determine if the current page is the last page in the list? If not, the back button was pressed.

See this reference: http://www.exforsys.com/tutorials/javascript/javascript-history-object-properties-and-methods.html

The real solution of course is to structure your application in such a way that usage of back/forward buttons actually work the way they are supposed to.


Need Your Help

upgrading from MVC4 to MVC5

asp.net-mvc asp.net-mvc-4 web-config upgrade asp.net-mvc-5

I have made that dreadful error of upgrading from MVC4 to MVC5 pre-release by updating the razor, and mvc webpage in my references I have System.Web.Mvc, System.Web.Webpages, System.Web.Webpages.Ra...