In Javascript, how do I “clear” the back (history -1)?

Instead of using window.location = url; to redirect,

try:

window.location.replace(url);

after using replace() the current page will not be saved in session
history, meaning the user won’t be able to use the Back button to
navigate to it.

Leave a Comment