Skip to content Skip to sidebar Skip to footer

Change Url Link With Javascript Without Refresh

Is it possible to automatically change the url example.com/4000/title-2/#!4000 to example.com/4000/title-2 without to refresh the page ? Basically to remove '/#!4000' from the URL.

Solution 1:

dont know if it is enough for you and whether it works completely cross-browser... chrome accepts:

location.hash = "";

but this keeps the "#" in the address bar

in modern browsers that completely support the html5 history api you do:

window.history.replaceState('Object', 'Title', '/4000/title-2');

EDIT: this dies not change the history of the browser

EDIT 2: just found this stackoverflow resource

Post a Comment for "Change Url Link With Javascript Without Refresh"