Since the URL is controlled by the browser when the URL changes, the page reloads. Still for what you want to do, on pages where you don't need materials after type ?.
window.location = "http://www.mysite.com" //or whatever your site url is
To do this dynamically, you can use the following function and then use window.location
function getPathFromUrl(url) {
return url.split("?")[0];
}
Note . When you change the URL of the page will be updated.
source
share