Changing URL without refresh?

前端 未结 5 1830
臣服心动
臣服心动 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条回答
  •  孤街浪徒
    2021-01-07 01:28

    using the history api you could do something like this

      if (history && history.pushState){
         history.pushState(null, null, '/new/url');
      }
    

    try it in your browser now with chrome js console

    thats all it takes (maybe a little more, but thats the basis of it

    read more in http://diveintohtml5.info/history.html

提交回复
热议问题