How to get the browser to navigate to URL in JavaScript [duplicate]

This works in all browsers:

window.location.href="https://stackoverflow.com/questions/1226714/...";

If you wanted to change the page without it reflecting in the browser back history, you can do:

window.location.replace("https://stackoverflow.com/questions/1226714/...");

Leave a Comment