change to new url in javascript code example
Example 1: js change url
window.location.href = "www.google.com";
Example 2: javascript change url
history.pushState({}, null, newUrl);
window.location.href = "www.google.com";
history.pushState({}, null, newUrl);