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://laravelcode.com";
If you want to simulate an HTTP redirect, use location.replace
// same as an http redirect window.location.replace("https://laravelcode.com");
You can also redirect using JQuery library.
I hope it will help you.