JavaScript change page URL code example
Example 1: js onclick redirect
<button onclick="location.href='www.yoursite.com'">Click Me</button>
Example 2: js change url
window.location.href = "www.google.com";
Example 3: javascript change url
history.pushState({}, null, newUrl);