How to rewrite URL without refresh, like GitHub.com

前端 未结 3 741
别跟我提以往
别跟我提以往 2020-11-29 05:56

I was browsing GitHub.com and I noticed when looking at the source for a repository, and you click on a file, the source code slides in and the URL changes, but it doesn\'t

3条回答
  •  北荒
    北荒 (楼主)
    2020-11-29 06:57

    I found this article which explains these HTML5 features - window.history.pushState(), window.history.replaceState() and the onpopstate() event: http://www.spoiledmilk.dk/blog/?p=1922

    As the article mentions, Flickr is also using this technique in several places.

提交回复
热议问题