Append parameter in url without reloading page

后端 未结 2 586
故里飘歌
故里飘歌 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

提交回复
热议问题