0

So I want to store a session variable when a certain link on the page is clicked, so when the link is clicked it goes through to a controller where I set the session variable successfully. Next I click my back button in the browser and echo the session variable out but it doesn't echo out until I refresh the page again.

The idea is the session variable is supposed to update depending on which link is clicked which does work, however if the variable is set and I click another link to update it, then click back in the browser, it still shows the old session variable until I refresh the page where the new one takes effect.

I hope this makes sense & I've worded my question ok, if not let me know if any clarification is needed.

Thanks, Sam.

Sam Fullen
  • 67
  • 7
  • I believe when you hit the back button in the browser, the browser is just showing you a cached version of that page so it doesn't have to reload it again. You can probably test this by going to your page, removing the route of the page you were on, and hitting back and seeing if it still works even without a route. – user1669496 Oct 19 '16 at 17:05
  • Okay, so I clicked a link which took me to my new page, I removed the route for that page and clicked back and the page still loaded. Is this my issue you think? – Sam Fullen Oct 19 '16 at 17:10

1 Answers1

1

Try setting cache header to do not cache like here: https://stackoverflow.com/a/17550224/2529486

Note that App::before doesn't works, but if it's browser I think you can fix this by using some javascript.

Community
  • 1
  • 1
VeeeneX
  • 1,556
  • 18
  • 26