One way to do that would be to use the
location.href. Here’s an example:
window.location.href = "https://digitalocean.com";
Here is a quick demo:
If you want to redirect the user to a specific page on your site just specify the page itself:
window.location.href = "some-page.html";
Another option would be to use
One of the main differences between
location.href is that with
location.replace the user’s current page will not be saved in the session, which means that your users will not be able to go back to the old page with the ‘Back’ button.
Hope that this helps!