If you want to simulate like someone clicking on a link, use location.href
// same as user clicking on a link window.location.href = "https://hackthestuff.com";
If you want to simulate an HTTP redirect, use location.replace
// same as an http redirect window.location.replace("https://hackthestuff.com");
You can also redirect using JQuery library.
Was this article helpful?
Leave a comment
Copyright 2021 HackTheStuff