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,468
  • 11
  • 41
  • 60
Mark_54
  • 1,273
  • 3
  • 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
  • 110,221
  • 32
  • 151
  • 174
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
  • 230,875
  • 49
  • 477
  • 553
Ascalonian
  • 13,791
  • 18
  • 70
  • 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