开发者

Which Javascript Toolkit Degrades Most Gracefully?

I've looked through many Javascript toolkits.

Each of them have different strengths, but all of them seem to be missing a usable backup solution if Javascript fails or is turned off.

So I'm looking for the Javascript toolkit/framework that has the best backup method when Javascript fails.

====

For example:

I'd like to have a simple AJAX request, that loads data into a DIV on click.

But if Javascript fails or is turned off, I want to have some kind of alternative way for users to access that content.

I could use PHP, but that would involve developing each feature twice... Is this i开发者_JAVA百科s the only way?


You should build your application as simple html which would work without js. And only then js should be implemented. In this case you'll have usable application event without js support.


If you have a lot of JavaScript code, you can reuse it on the server side using node.js framework, if your objective is to write code only once and run it wherever you want. Node.js is server side JavaScript that can run your client-side code on the server-side. You client-side code will run on server-side with little or no modification as per node.js folks. As far as your Ajax call go... Those should also work just fine, at least in theory, according what I have heard of about node.js. When you run your client-side Ajax code on server-side and that Ajax code contains a "get" request, the node.js framework loads the requested data from the file system (a file or db or xml or whatever) and returns the data set normally as if the request actually came from a client-side call. While I have not written any code to test it, there are a few examples of it on the developer.yahoo.com. Disclaimer: I don't work for Yahoo or have any association with any company that promotes Yahoo.


Javascript is an awesome language. In fact, you can effectively use it on the server-side with Node.js. Now with jsdom you can actually copy your client-side code and generate whole page on the server.

@davglass at the YUI team did some amazing work, intergrating client-side modules on the server.

  • Node.js, YUI 3 & Dom Manipulation… Oh My!
  • Video: Dav Glass — Using Node.js and YUI 3
  • nodejs-yui3 on github

You can see that almost all YUI component can run on the server-side as a fallback.
e.g.: datatabe, calendar, tabview

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜