I am currently working on a basic HTML file that includes a JavaScript code snippet:
<p>Press The Back Button and see a message!</p>
<script>
window.onpopstate = function(event) {
alert("location: " + document.location);
}
</script>
Running Android 11 and the latest version of Google Chrome, I encounter an issue where pressing the back button does not trigger the desired alert displaying the location.
https://i.sstatic.net/ld9IM.png
Seeking advice on how to troubleshoot this problem and make the code work as intended. Any suggestions would be greatly appreciated!