let newurl = window.location.protocol + '//' + window.location.host + 'path you want'
if (history.pushState) {
window.history.pushState({ path: newurl }, 'title',newurl)
} else {
window.history.replaceState({ path: newurl }, 'title', newurl)
}