开发者

Open new page without leaving current page

开发者 https://www.devze.com 2023-03-31 21:27 出处:网络
Thanks for reading my question. I saw Gizmodo & Lifehacker has this feature. Take a look at this http://lifehacker.com/

Thanks for reading my question. I saw Gizmodo & Lifehacker has this feature. Take a look at this http://lifehacker.com/ When you click link in right sidebar, example (http://lifehacker.com/5835630/apple-launches-itunes-match-beta-for-developers). The address bar show "http://lifehacker.com/5835630/apple-launches-itunes-match-beta-for-developers", it means new page are opened. But contents of current page is not changed, like AJAX load. Bu开发者_开发问答t the different is: when using AJAX load, we will make request to new page, but address bar is still current URL. And lifehacker.com's address bar shows destination URL, not current URL. I tried to inspect request, and saw Lifehacker.com make POST request to opened page (http://lifehacker.com/5835630/apple-launches-itunes-match-beta-for-developers), and then render contents, like AJAX load does, but my problem is Why their addres shows new URL instead of URL (or hashbang URL like http://lifehacker.com/#something). I tested in different browsers, and this feature only work with Chrome & FF, not Opera and IE, so I think is features of Chrome & FF, is it right ? Thankyou


This is achieved through the HTML5 history API or older hacks that included an iFrame..

See this article on information on HTMl5 History: http://diveintohtml5.ep.io/history.html

See this demo for the code in question.

You may also want to look at the PJax library that provides this functionality (through the above means)

0

精彩评论

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