I need to prevent page refresh when back button clicks in my wordpress application. I tried some solutions available online, but no use.
Here is my code in functions.php
<script>
console.log(123)
$(window).on('popstate', function(event) {
console.log("pop");
});
</script>