Javascript to modify current URL?

This question already has an answer here:

  • Modify the URL without reloading the page 18 answers

  • 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/70302.html

    上一篇: Jquery window.location.hash如何替换?

    下一篇: Javascript来修改当前的URL?