Search code examples
httpcachingbrowsernavigationback-button

Catching when using the browser's back or forward button


In a news feed app for example, if you press the browser's back or forward button does the browser load the actual page again (calling the database again and refreshing the feed results) or does it load a cached version of the page with the results you saw when you first loaded it?


Solution

  • Depends on the cache-control settings defined in the HTTP response header from the server. How you control this in code will depend on the server side technology you're using. More info on the HTTP cache settings here.