I am trying to show an alert
when clicking the back button in Chrome. It is working properly in Firefox, but not in Chrome. Where do I need to change the code?
jQuery(document).ready(function($) {
history.pushState(null, document.title, location.href);
window.addEventListener('popstate', function (event) {
history.pushState(null, document.title, location.href);
alert('Back button was pressed.');
});
});