Append parameter in url without reloading page

后端 未结 2 587
故里飘歌
故里飘歌 2021-01-25 16:06

I am using following code to append param to url. This is working fine but when parameter is appended in url, page is getting reloaded. I want to use this functionality without

相关标签:
2条回答
  • 2021-01-25 16:22

    There is a new feature that aims to replace the use of location.hash with a better solution: pushState.

     window.history.pushState(data, "Title", "/new-url");
    

    More information: http://badassjs.com/post/840846392/location-hash-is-dead-long-live-html5-pushstate

    0 讨论(0)
  • 2021-01-25 16:28

    You can only do this using history.pushState(state, title, url) which is an HTML5 feature.

    0 讨论(0)
提交回复
热议问题