Sam Fullen
Sam Fullen

Reputation: 67

setting a laravel session in controller and when I go back to the previous page the session variable doesn't take effect until I refresh that page

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.

Upvotes: 0

Views: 708

Answers (1)

VeeeneX
VeeeneX

Reputation: 1578

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.

Upvotes: 1

Related Questions