开发者

How is pjax working?

开发者 https://www.devze.com 2023-02-23 17:10 出处:网络
I just discovered pjax and I find it 开发者_StackOverflowcompletly awesome. If I understand it correctly, it\'s AJAX, but without its problems (fully degradable, the URL and the title of the page is c

I just discovered pjax and I find it 开发者_StackOverflowcompletly awesome. If I understand it correctly, it's AJAX, but without its problems (fully degradable, the URL and the title of the page is changing when using it, compatible with search bots...).

But I am very curious as how it's working ? How can we change the URL in the browser, without the page to change... I read somewhere you need Firefox 4, is that a new "web" feature then ?


It's just a wrapper around "$.ajax()". It uses the new "pushState" and "replaceState" methods to manipulate the history.

Also see this SO question too, and notably the link to History.js.

edit — note that by writing "just a wrapper" I do not mean to belittle the pjax plugin. I simply meant that it's not some radical new functionality; it's still XMLHttpRequest under the covers.

0

精彩评论

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

关注公众号