Hash Tag stop window.location Javascript事件

Hash Tag stop window.location Javascript事件,javascript,click,query-string,hashtag,window.location,Javascript,Click,Query String,Hashtag,Window.location,当#标记出现在地址栏(如“”)中URL的末尾,然后在单击事件上,我想使用window.location Javascript事件在页面上重定向时,它就不起作用了 var redirectURL = window.location.href.split('?')[0];//Remove all existing query string redirectURL = redirectURL + "?" + newqueryStringName + "=" + newqueryStringValu

当#标记出现在地址栏(如“”)中URL的末尾,然后在单击事件上,我想使用window.location Javascript事件在页面上重定向时,它就不起作用了

var redirectURL = window.location.href.split('?')[0];//Remove all existing query string  
redirectURL = redirectURL + "?" + newqueryStringName + "=" + newqueryStringValue;

window.location = redirectURL;
如何在地址栏中存在#时重定向到新页面