Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Neamix's avatar

Cookie not working when i click back

Hello, I am making booking service that the user can choose a group of service and the amount of each service and i saving them in cookie the problem that when the user click back button of the browser i can't find this services in cookie and show them the user must refresh the page how can i fix this behavior

0 likes
2 replies
peter_opps's avatar

It looks like what you're writing about is the normal backward/forward-cache of the browser. This behaviour also exists for example when logging into Amazon and then going back. You can't really disable that but you could probably add some JavaScript that automatically refreshes when it the backward/forward-cache is used

Please or to participate in this conversation.