Javascript: Change Url without refreshing the page

This question already has an answer here:

  • Modify the URL without reloading the page 18 answers

  • In newer browsers that support history.pushState you can replace the url without reloading.

    Lets say a user browses to http://example.com/ernie.html

    window.history.pushState({ foo: "bar" }, "page 2", "bert.html");
    

    Will change the address bar to http://example.com/bert.html , but won't cause the browser to load bert.html or even check that bert.html exists.

    链接地址: http://www.djcxy.com/p/70310.html

    上一篇: 网站如何在网页更改中持续播放标题中的音频

    下一篇: Javascript:更新网址而不刷新页面