I have a url that user goes to http://www.test.com/test/test#design/test
I want to remove the hash from the url without reloading the page, so that users are now on http://www.test.com/test/test
How can I do that using javascript/jquery?
I have a url that user goes to http://www.test.com/test/test#design/test
I want to remove the hash from the url without reloading the page, so that users are now on http://www.test.com/test/test
How can I do that using javascript/jquery?
Try window.history.pushState('', '/', window.location.pathname);
and fallback to window.location.hash = ''
if push state is not supported, but this will leave the trailing #.
if(window.history.pushState) {
window.history.pushState('', '/', window.location.pathname)
} else {
window.location.hash = '';
}
Try this code:
window.history.pushState("","", "#");