Link to home
Start Free TrialLog in
Avatar of ratWonder
ratWonder

asked on

Reload previous page on "back" button.

Hello JS gurus.

Do you know if there's any way, using JavaScript, to ensure that when the back button is pressed, the previous page (history.go(-1)) is *reloaded* for *all users*, rather than just loaded from the cache?

I thought it might be possible to put JavaScript into the page that would reload it if it was reached by pressing the back button, but I have no idea how to detect if this is the case.

Any help would be most appreciated.

Robin.
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

You should fix your application so it can handle a back or not depend on handling a back

You can expire the page and use POST for one
Avatar of ratWonder
ratWonder

ASKER

Sorry I didn't understand that.

I tried preventing the browser from caching by adding:
  <meta http-equiv="Pragma" content="no-cache" />
  <meta http-equiv="Expires" content="-1" />

But no joy - when I click back it still shows the old version of the page.
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Forced accept.

Computer101
EE Admin