开发者

Change browser URL and page content without reload and without using fragments

开发者 https://www.devze.com 2023-02-10 16:22 出处:网络
I\'m well aware of the technique of using URL fragments to 开发者_StackOverflow中文版track state on an AJAX powered webpage, but lately I\'ve noticed a lot of sites that are doing something similar bu

I'm well aware of the technique of using URL fragments to 开发者_StackOverflow中文版track state on an AJAX powered webpage, but lately I've noticed a lot of sites that are doing something similar but without fragments.

The picture viewer in the latest version of Facebook for example operates this way. The left and right navigation buttons are simple links with no fragments that when clicked change the browsers URL without doing a full page load.

Another example is GitHub's repository browser, each of the files/folders is a simple link that changes the page state and browser URL without reloading or using page fragments.

Can anyone explain, or point me to an explanation of how this works? I've done some searching, but there is so much content on using fragments that I haven't been able to find anything.


I believe this is due to the new History pushState HTML5 feature


They are using new HTML5 History API. I think this is what you want. check the menu items in this page http://tinywall.info/demos/html5-history-api/menu1.php

The tutorial to implement is right here : http://t.co/M4RvnvoQ

0

精彩评论

暂无评论...
验证码 换一张
取 消