Changing URL without refresh?

前端 未结 5 1864
臣服心动
臣服心动 2021-01-07 01:11

I found an app on the internet inside of which, when you click A link it will redirect to A page without refreshing the whole place and changing the url address bar, I know

5条回答
  •  Happy的楠姐
    2021-01-07 01:49

    You can use HTML5 History API to to change the URL without refreshing the page, check out this tutorial from Mozilla https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history
    Also check out https://github.com/browserstate/History.js for cross-browser solution

    The jQuery PJAX plugin https://github.com/defunkt/jquery-pjax will help you do what you have mentioned, it will help to update the content and change the URL without refresh.

    Here is an example: http://pjax.heroku.com/
    Source code for this example is available here: https://github.com/defunkt/jquery-pjax/tree/heroku

提交回复
热议问题