7

How can I force a page refresh of page 1 when a user returns to it from page 2 by pressing the back button? Are there vbscript or javascript approaches or is it down to set the 'no cache' somehow?

Jan Carlo Viray
  • 11,856
  • 11
  • 42
  • 63
Mark_54
  • 1,273
  • 4
  • 15
  • 21

2 Answers2

6

Set a cookie on page 2.

If the cookie is detected on page 1, reload the page.

Diodeus - James MacFarlane
  • 112,730
  • 33
  • 157
  • 176
1

What about doing something like this?

<script>
    if   (document.referrer == "http://www.page2.html") 
          window.location.reload(); 
    }
</script>

Just throw that at the top of your page 1 and this should work.

Update

I also found a solution on the Webdeveloper.com forums as well.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Ascalonian
  • 14,409
  • 18
  • 71
  • 103
  • 1
    Ascalonian, I tried this to occur on the body onload but it doesn't seem to recognised the referrer if it's been referred via the back button. Any ideas? – Mark_54 Feb 09 '12 at 20:22