Hi everyone,
I’m using a CODE widget where I set an item in localStorage to act as a flag. The purpose is to remember if a user has closed a popup, so it doesn’t appear on any other pages. If the user clicks a button to close the popup, I store this in localStorage. This code is shared across all pages of the site.
However, I’ve encountered an issue where the code doesn’t always trigger when I navigate from one page to another. I tried using DOMContentLoaded
, but it doesn’t seem to work reliably in this context.
How can I ensure that the code runs on every page load? Is there a better method to force the execution of the code each time I enter a new page?
Also I checked in devs tools → application → local storage that the value is stored there.
Thanks in advance for your help!