Skip to content

Instantly share code, notes, and snippets.

@fhdalikhan
Created April 28, 2021 17:13
Show Gist options
  • Save fhdalikhan/6e0b02606ea6030099b728ffeccd46df to your computer and use it in GitHub Desktop.
Save fhdalikhan/6e0b02606ea6030099b728ffeccd46df to your computer and use it in GitHub Desktop.
change browser's back button url
history.pushState(null, null, '<?php echo $_SERVER["REQUEST_URI"]; ?>');
window.addEventListener('popstate', function(event) {
window.location.assign("http://www.yoururl.com/");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment