// Listen for the back button click event window.addEventListener('popstate', function(event) { // Open the desired website window.open('https://example.com', '_blank'); }); // Push a new state to the history when the page loads window.history.pushState({ page: 1 }, '', ''); // Function to disable the back button functionality function disableBackButton() { window.history.pushState(null, '', ''); window.onpopstate = function() { window.history.pushState(null, '', ''); }; } // Call the function to disable the back button disableBackButton();

Comments

Popular posts from this blog