2011年了还有必要降级js吗?
严肃的问题。
我尝试了大多数著名的网站(包括 facebook),我可以说,禁用 js 后,大量的功能根本不会降低。我总是被告知 js 应该优雅地降级,但这在当今时代仍然适用吗?
几个网站正在放弃 ie6 支持,并且大多数 web2.0 严重依赖 js(尤其是 ajax,我什至发现一些网站在没有启用 js 的情况下不允许您登录)。
您对此有何看法?
编辑:
我想补充一点,我首先开发没有 js 的 web 应用程序,然后用它来增强它们。问题是,年复一年,js 越来越成为网络的一部分。 HTML5、canvas 和重型 js 应用程序开始兴起。我们是否会达到大多数网站都强制使用 js 的地步?我谈到 facebook 是因为该网站实际上会降级并且无需 js 即可使用,但大多数功能和快捷方式都被剥离到了该网站感觉沉闷和陈旧的地步。还有一些例子,js 比服务器端脚本更好,例如,与 php 实现相比,大表的排序速度更快,服务器密集程度也更低。
ps 我不知道如何使其成为社区维基,但我会的,我只是对您的意见感兴趣。
Serious question.
I tried most of the famous websites (including facebook) and I can say that tons of functionality doesn't degrade at all with js disabled. I've been always told that js should degrade gracefully, but does this still applies in these day and age?
ie6 support is being dropped by several sites, and most of the web2.0 relies heavily on js (especially ajax, I even found some sites that doesn't let you login without js enabled).
What are your thoughts about it?
EDIT:
I want to add that I for one develop webapps without js first and then enhancing them with it. The issue is that year after year js is more and more a part of the web. HTML5, canvas and heavy js apps are starting to rise. Will we ever reach the point where js will be compulsory in most of the websites? I talked about facebook because the site actually degrades and is usable without js but most of the functionalities and shortcuts are stripped to the poin that the site feels dull and old. There are also example where js is better than server side scripting, for instance the ordering of large tables is faster and less server intensive that a php implementation.
p.s. I don't know how to make this a community wiki, but I will, I'm just interested in your opinions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
即使没有必要,我仍然更喜欢编写不需要需要启用 JS 的应用程序。
我认为您的网络应用程序的非 JS 版本没有太多受众,即使有,谁在乎呢?这只是一小部分人,你不会强迫他们升级浏览器来惹恼很多人。
但是,我不会为我的用户编写降级的 JS,而是为我自己编写...
事实上,我根本不编写降级的 JS - 我写增强 JS。
我觉得如果我首先在不使用 JavaScript 的情况下编写应用程序,然后稍后添加 JavaScript 来增强应用程序,那么我可以更加有方向性和成功地编写应用程序。
Even if it isn't necessary, I still prefer to write applications that don't need JS enabled.
I don't think there is much audience for non-JS versions of your web apps, and even if there were, who cares? It's such a small percentage of people, you're not going to annoy very many people by forcing them to upgrade their browsers.
However, I don't write degrading JS for my users, I write it for me...
In fact, I don't write degrading JS at all - I write enhancing JS.
I feel that I can write applications with more direction and success if I first write them without JavaScript, and add the JavaScript later to enhance the application.
2011 年,仍然有几种重要类型的用户无法假设 javascript 能够正常运行:
所以我认为最好还是提供优雅的降级。
In 2011 there are still several important types of users for whom you can't assume javascript will function properly:
So I think it's still best to offer graceful degradation.
与这些问题一样,答案是视情况而定。
这取决于您的受众(这可能与您能找到的任何通用浏览器统计数据有很大不同)。
其中有多少人禁用了 JavaScript?您关心这些用户吗?如果不是,那么当然,不要优雅地降级。
也就是说,至少我建议您至少让您的网站无需 JavaScript 即可使用和导航。
As always with these questions, the answer is it depends.
It depends on your audience (which will likely differ widely from any generic browser statistics you can find).
How many of them have JavaScript disabled? Do you care about those users? If not, then sure, don't degrade gracefully.
That said, at the very least, I'd recommend you at least make your website usable and navigable without JavaScript.
该网站应该“工作”。不一定要唱歌跳舞,但也不应该排斥没有JS的人。
大多数屏幕阅读器仍然不使用 JS,因此您的所有内容都应该可供他们使用。
The site should "work". It doesn't have to sing or dance, but it shouldn't exclude anyone without JS.
Most screen readers still don't use JS, so all your content should be available to them.
你的目标是谁?极客,还是 JavaScript 被禁止的公司(或更糟糕的是,军事机构)的员工?
即使您不必 100% 为您制作的每个应用程序应用它,了解如何降级仍然是件好事。
Who is your target? Geeks, or employees of companies (or worse, military institutions) where javascript is banished ?
It's still good to know how to degrade, even if you don't have to apply it 100% for every app you make.
我认为 javascript 是一项技术,应该付出改进而不是退化的代价,我们不能仅仅因为它可能影响较小的社区而退化技术,而不仅仅是因为它可能带来一些威胁。
I think that javascript is a technology and that should cost it to improve not to degrade, we cannot degrade technology just because it could effect minor community and not just because it could bring some threat.