我开发 Web 应用程序已经有几年了。我面临的问题之一是必须开发未启用或不可用 JavaScript 的 Web 应用程序。我知道这是几年前的一个问题,但我很想知道其他网页设计师、开发人员如何看待这个问题?这仍然是一个问题吗?
我之所以问这个问题,是因为在我看来,我们只是在迎合现在不太可能发生的情况。尤其是对于面向公众的网站和网络应用程序?我的评估正确吗?我很想知道其他网络开发人员和设计师的经验和学习成果,
谢谢。
I have been developing web applications for a few years now. One of the issues that I face is having to develop web apps where javascript is not enabled or not available. I know this was a issue a few year back but am curious to know what other web designers, developers think about this issue? Is that still an issue?
The reason I am asking this is because it seems to me we are just catering for scenarios that is very unlikely to happen now a days. This is especially with regards to public facing websites and web applications? Am I right in my assessment? I am keen to know the experiences and any learnings of other web developers and designers
Thanks.
发布评论
评论(5)
+1 表示渐进增强。在这里,您可以通过直接的 HTML/CSS 获得基本的、非华而不实的功能,然后获取 JavaScript 代码来补充该功能或用它自己的功能替换该功能。
例如,如果页面上有分页导航,其中包含第 1 页、第 2 页等的简单超链接,例如。
然后你就会有 JavaScript 功能来查找你的
div.paging
元素并用更优雅的东西完全替换它,例如(在伪代码中)至于它可以被替换什么,它可能是 Google图像风格无限滚动(是的,我知道 Bing 首先拥有它),或者 Twitter 的方法,在底部有一个大的下一页按钮,动态附加下一组结果(看看http://twitter.com/codinghorror - 向下滚动并单击“更多”)。
这种“渐进增强”方法的好处是:
如果您关心 SEO,那么最后一点应该是最重要的。
然而,有时您可以合理地忽略渐进式增强并构建一个依赖 JavaScript 的网站,没有它就无法工作。您通常会为高级“Web 应用程序”或移动优化的 Web 应用程序执行此操作,例如 Google 地图、日历应用程序、使用
元素的 HTML5 绘图应用程序、 HTML5 驱动的游戏等。我的规则是,任何“基于内容”的内容(博客网站、新闻网站、电子商务商店等)都应该应用渐进增强,而任何“应用程序”都可以摆脱强制 JavaScript 的束缚。
最终,这取决于您正在构建的内容以及渐进增强路线是否适合您。
禁用 JavaScript 的人数统计数据很难获得(这里有一些,但它是从 2008 年开始,还有 这篇 StackOverflow 帖子 从 2008 年开始),但我认为它变得越来越少由于依赖 JavaScript(Google 文档、地图等)的 RIA 应用程序和 HTML5 应用程序数量不断增加,可能会禁用脚本。还要考虑到越来越多的移动互联网设备(iPhone、iPad 等)不允许您禁用 JavaScript。
+1 for Progressive Enhancement. This is where you have basic, non-flashy, functionality with straight-forward HTML/CSS then get JavaScript code to either supplement or replace that functionality with it's own.
For instance, if you have paging navigation on the page that consists of simple hyperlinks for page 1, page 2 etc eg.
Then you'd have JavaScript functionality that looks for your
div.paging
element and completely replaces it with something more elegant, eg (in pseudo code)As for what it could be replaced by, it could be Google Images style infinite scroll (yes I know Bing had it first), or Twitter's approach of having a big next page button at the bottom that dynamically appends the next set of results (have a look http://twitter.com/codinghorror - scroll down and click 'More').
The benefits of this 'Progressive Enhancement' approach are:
The last point should be the most important if you care about SEO.
There are times, however, when you can reasonably ignore Progressive Enhancement and build a website which relies on JavaScript and won't work without it. You'd typically do this for advanced 'Web Applications' or mobile optimised web-apps for instance, think Google Maps, a calendar app, a HTML5 drawing app that uses the
<canvas>
element, an HTML5 powered game etc. My rule, anything 'Content Based' (blogging site, news site, e-commerce shop etc.) should apply Progressive Enhancement, whereas anything 'Application-y' could just get away with mandating JavaScript.Ultimately, it comes down to what you're building and whether the Progressive Enhancement route is right for you.
Stats for number of people with JavaScript disabled is hard to come by (some here but it's from 2008, also this StackOverflow post from 2008), but I think it's becoming increasingly less likely to have script disabled because of the increasing number of RIA apps and HTML5 apps that rely on JavaScript (Google Docs, Maps etc.). Also take into account the increasing number of Mobile Internet Devices (iPhones, iPads etc.) that don't allow you to disable JavaScript.
逐步增强!在花了太长时间对 AJAXd 网站感到恼火之后,我几乎总是在禁用 JS 的情况下进行浏览,因此在添加 JS 功能之前总是从简单的页面加载表单等开始。
像 jQuery、mootools 等 JS 框架变得越来越流行,因为几乎任何人都可以制作带有动画的“闪亮”网站。但我认为越多的人开始使用这些工具,普通浏览器就越不愿意启用 JS。
Progressive enhancement! I nearly always browse with JS disabled after spending way too long being annoyed by over AJAXd websites, so always start from simple page load forms etc before adding JS functionality.
JS frameworks like jQuery, mootools etc are getting more and more popular as pretty much anyone can produce a "shiny" website with animations. But I think that the more people start to use the tools, the less willing any regular browser will be to enable JS.
有些人认为你还需要照顾那些关闭 CSS 的人。所有这些都会让你发疯,考虑到网络世界的所有“假设”。那些关闭 javascript 的人知道他们会面临什么,并且不会惊讶地发现一个网站因此而无法工作。如果他们知道足够的信息来关闭它,那么他们就知道足够的信息来在需要时重新打开它。
我认为蒂姆·伯纳斯·李曾经说过,网络总是应该是可编写脚本的。脚本挂钩内置于 HTML 中,所有浏览器都可以使用它。几乎每个人都打开了它,而且他们应该这样做。利用它来发挥你的优势。
There are some who think you need to also take care of people who have CSS turned off. All this can drive you crazy, accounting for all the "what ifs" of the web world. Those who turn off javascript know what they are in for and are never surprised to find a site that doesn't work because of it. If they know enough to turn it off then they know enough to turn it back on when they need it.
I think it was Tim Berners-Lee who once said the web was always meant to be scriptable. Scripting hooks are built into HTML and all browsers work with it. Almost everyone has it turned on and they should. Use it to your advantage.
即使在今天,有些人(包括我自己)仍然默认关闭 JS。专业构建的网站要么警告禁用的功能,要么在没有 JS 的情况下工作(通过整页重新加载)。
Even today, some people (including myself) have JS turned off by default. Professionally built sites either warn about disabled features or work without JS (via full page reloads).
我建议您尝试确保您的网站的基本功能无需 JavaScript 即可使用。
如果您按照这种方式工作,即使您或其他开发人员允许不完美的 JS 进入生产站点,您最终也会得到一个可以正常工作的站点 - 严重的 JS 错误并不一定会完全导致问题。
另外:AJAX、效果和其他无用的东西可能需要aaaaaaages 来调试。用户不介意简单。您应该以简单为目标,慢慢地添加花哨的功能,添加时进行用户测试,以避免创建令人困惑和错误的 AJAXeffectsFluffy 垃圾堆......
I would recommend you try to ensure the basic functionality of your site is available without javascript.
If you work this way, you'll end up with a site that works even if you, or another dev, allows imperfect JS into the production site - a serious JS error won't necessarily be a total show-stopper.
Also: AJAX, effects and other fluff can take aaaaaaages to debug. Users don't mind simple. You should aim for simple, and slowly add bells and whistles, user testing as you add, to avoid creating an AJAXeffectsFluffy crap heap that is confusing and buggy...