Luis Masuelli
Luis Masuelli

Reputation: 12343

Is there a cross-browser way to make previous page actually load content from the server when user goes BACK in the browser?

As my experience dictates, when I click BACK in my browser, the previous page shows again, with the starting DOM (at least starting* in the last request sent to its URL) displaying.

(* as returned from the server response; no dom-altering javascript running yet)

Is there a way to make sure the previous page is loaded again (i.e. another actual request to its URL) when the user presses BACK button?

(I expect the answer will be HTTP-related, e.g. headers, and no specific backend dependent - I already know how to send a header with my backend).

Upvotes: 1

Views: 74

Answers (1)

Vitaly Kulikov
Vitaly Kulikov

Reputation: 723

Add following headers to responses which should not be cached

Cache-Control:no-store
Cache-Control:no-cache
Pragma:no-cache
Expires:Mon, 26 Jul 1997 05:00:00 GMT

Pragma is for HTTP 1.0, just in case you have such users.

Upvotes: 3

Related Questions