Is pjax the way to go for “fluid” navigation?

我的未来我决定 提交于 2019-12-20 08:56:30

问题


I've started playing with pjax, as I want to provide a fast, fluid experience for my users without a lot of unnecessary HTTP requests and repeated rendering of unchanged HTML.

I have it working fairly well on my site, and I must say it was surprisingly easy to get up and running, considering how much a difference it makes for the experience.

However, I'm seeing very little support for pjax -- both on StackOverflow, and on the web in general (a google search returns many results at the top totally unrelated to web development).

But as impressed I am with it, even if it's not widely supported yet, I may still use it. My main concern is running into big problems later when I've already invested my code in it without a lot of support. So I wanted to make sure there wasn't something else out there.

Are there alternatives for implementing the same functionality that pjax provides that I'm not aware of? Or is it so new that not many people know about it yet? Or, is it just a bad/problematic implementation?


回答1:


http://caniuse.com/#search=history will give you an indication of what supports the current version of pjax.

The severside code that sniffs the request for PJAX header could also react to the browser and degrade nicely for other browsers.

http://forum.kohanaframework.org/discussion/8869/kopjax-simplistic-pjax-jquery-ajax-module/p1#Comment_60090 is a decent list of alternate options.

If you don't mind missing support for other browsers or make changes to do so then PJAX's only draw back I can see is the need to have 1 chunk/partial to update.




回答2:


I was running into issues trying to work around the 1 container partial update limitation, so I put together a simple alternative that degrades gracefully. djax achieves the same result as pjax, except it is indifferent to layout changes between pages, and allows you to update as many partials on the page as you like.




回答3:


I'm with Jerad - based on using the demo in IE, it appears to degrade gracefully.

If you can live with some users not getting the AJAX experience, I don't see anything to lose.




回答4:


I'm also getting "Sorry, not supported" messages.

Judging by the browser support issues pointed out here, I would say that while pjax sounds interesting, it probably isn't ready for the prime-time yet.

It doesn't work in Firefox 3.6, but that's a minor issue as FF4 is now available. But for the foreseeable future, your really big blocker is IE. If the product isn't even supported by IE9, then you're really not doing yourself any favours by using it.

But with the rate of change in the browser world at the moment, this will improve, so feel free to experiment with it with a view to implementing it at a later date -- I wouldn't be suprised if this answer is completely different in a year's time -- But for the time being I'd say that's all it is: an experimental curiosity.




回答5:


Pjax is a great solution and it degrades gracefully. If you want a more in-depth solution you can use backbone-rails but it's a bit more work. I believe it is more compatible with older browsers as it does not depend on push state...



来源:https://stackoverflow.com/questions/6148097/is-pjax-the-way-to-go-for-fluid-navigation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!