A quick tip: If you want to replace the current document and history from your browser. Use the window.location.replace() or location.replace().
Navigate back on your browser to see the difference.
window.location
window.location.replace
More Details: https://developer.mozilla.org/en-US/docs/Web/API/Window/location#Methods