Mat*_*van 1 url jquery query-string
基本上我有一个被加载的网址
http://somewebsite.com/Staging/hello/index.php?action=viewByGrid&subdo=show&projectID=-1&stat=1&workStageID=-1
加载后。我希望 URL 显示为
http://somewebsite.com/Staging/hello/index.php?action=viewByGrid
我需要在我的document.ready()加载后不久删除查询字符串
使用history.replaceState或history.pushState。它得到了相当好的支持,并且可以满足您的需求。前者不会插入新的历史条目,只是修改当前的历史条目,而后者会为新的 URL 添加一个新的历史条目。前两个参数不重要,第三个是改变url的
$(document).ready(function(){
   var href = window.location.href,
       newUrl = href.substring(0, href.indexOf('&'))
   window.history.replaceState({}, '', newUrl);
});
| 归档时间: | 
 | 
| 查看次数: | 3596 次 | 
| 最近记录: |