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. Note that is important to remove the "/" before the hashbang not just the hashbang .
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答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