Javascript来修改当前的URL?

这个问题在这里已经有了答案:

  • 修改网址而不重新加载页面18个答案

  • if (location.search)
    {
        location.href = location.protocol + "//" + location.host + location.pathname;
    }
    

    这应该重新加载到当前的URL减去任何查询字符串。


    var new_url     = (window.location+'').replace(/?.*/,'');
    window.location = new_url;
    

    document.location.href=goodpart[0];
    
    链接地址: http://www.djcxy.com/p/70301.html

    上一篇: Javascript to modify current URL?

    下一篇: Any way to change the header URL without reloading?