Why is the popstate event handler not working?

I have registered the popstate event as a listener in JS, but only in Safari on My Mac it does not fire when the back button is pressed; in Chrome and Firefox it fires.

My Safari version is 16.3 (18614.4.6.1.5).

Here is the code


            window.history.pushState(null, null, null);

            window.addEventListener('popstate', (event) => {
                console.log('fire!')
            });

How can I get back button event detection in Safari?