在没有JavaScript的情况下,优雅的降级还有用吗?

时间:2022-09-06 08:15:42

When even mobile browsers have JavaScript, is it really necessary to consider potential script-free users?

当移动浏览器都有JavaScript时,真的有必要考虑没有脚本的潜在用户吗?

14 个解决方案

#1


17  

Yes. Your web pages aren't just consumed by people: they're consumed by search engines, and crawlers, and screenscrapers. Most of those automatic tools don't support Javascript, and essentially none are going to generate UI events or look at deeply nested AJAX data. You want to have a simple static HTML fallback, if nothing else then so that your web pages are well indexed by the search engines.

是的。您的web页面不仅被人们使用:它们被搜索引擎、爬虫和屏幕抓取器使用。大多数自动工具不支持Javascript,基本上没有一个工具会生成UI事件或查看深度嵌套的AJAX数据。您希望有一个简单的静态HTML回退,如果没有别的,那么您的web页面就会被搜索引擎索引。

Forget the crazies who disable Javascript; think of the robots!

忘记那些禁用Javascript的疯子;认为机器人!

#2


13  

Yes.

People can (and do) browse with javascript disabled. If your site will work without users having to explicitly enable javascript for you, that makes them happy.

人们可以(也可以)在禁用javascript的情况下进行浏览。如果您的站点不需要用户为您显式地启用javascript,这将使他们感到高兴。

Exactly how relevant depends on your target audience, of course.

当然,确切的相关性取决于你的目标受众。

#3


11  

I would argue that you shouldn't go significantly out of your way to accommodate for non-JS users for the following reasons:

我认为,您不应该为了满足非js用户的需要而做出很大的努力,原因如下:

  • All Modern Browsers Support JS

    所有现代浏览器都支持JS

    This is a snapshot of browser usage today:

    这是今天浏览器使用的快照:

    http://www.w3schools.com/browsers/browsers_stats.asp

    http://www.w3schools.com/browsers/browsers_stats.asp

    Even the oldest common browser, IE6, supports basic JavaScript and AJAX. If you decide not to integrate certain features b/c of a JS dependence, this proves that you are essentially doing it for people who started with JavaScript enabled and explicitly chose to disable it. I think these people should expect for some features, and perhaps even entire sites, not to work as a consequence.

    甚至最古老的通用浏览器IE6也支持基本的JavaScript和AJAX。如果您决定不集成依赖于JS的某些特性b/c,这证明您实际上是在为启用JavaScript并明确选择禁用它的人做这件事。我认为这些人应该期待一些特性,甚至是整个网站,而不是因此而工作。

  • Few People Willingly Disable JS

    很少有人愿意禁用JS

    Building on my point above, average web users don't know or don't care that JS can be disabled in browsers. It's largely a tech savvy crowd who knows how to do this (myself included), and as tech savvy users we should know when to turn it back on as well.

    基于我上面的观点,一般的web用户不知道或不关心在浏览器中可以禁用JS。在很大程度上,这是一群精通技术的人,他们知道如何做到这一点(包括我自己),作为精通技术的用户,我们应该知道什么时候该把它打开。

  • Cost of Support

    成本的支持

    In light of the above, consider that choosing to accomodate users who have primarily willingly disabled JS comes with a very real cost. If you are managing a large project with heavy UI requirements, you can easily burn a lot of developer hours accommodating for what is a very small user preference. Check your budget. If it is going to take 2 devs working 40 extra hours each on the project to accomplish this feat, you are easily going to burn a few thousand dollars on what is essentially a non-issue for the vast majority of your users. How about using that time and investment to further buff up your core competency?

    考虑到以上这些,考虑到选择满足那些主要想要禁用JS的用户的需求是有代价的。如果您正在管理一个具有大量UI需求的大型项目,您可以轻松地消耗大量开发人员的时间,以适应非常小的用户偏好。检查你的预算。如果需要2个开发人员在这个项目上多工作40个小时来完成这一壮举,那么对于绝大多数用户来说,这基本上是没有问题的。用这些时间和投资来进一步提升你的核心竞争力怎么样?

  • Precedence

    优先级

    I may very well be wrong on this, but I think it would be difficult to find major media or social sites that
    don't rely on JavaScript for some
    portion of their functionality to
    work. If major businesses that rely
    on the operation and accessibility of their site to stay in business aren't doing it, there's a good chance it's because it isn't needed.

    我很可能在这一点上错了,但我认为很难找到主要的媒体或社交网站,它们的某些功能不依赖于JavaScript。如果依赖于运营和网站可访问性来维持运营的大型企业没有这样做,很有可能是因为不需要这样做。

CAVEATS:

警告:

Know your market. Continue to build XHTML/CSS that is semantic (preferably by using the RDFa W3C recommendation). Still strive to make your sites accessible to the visually impaired. Don't believe everything you read. ;)

知道你的市场。继续构建语义的XHTML/CSS(最好使用RDFa W3C推荐标准)。仍然努力使你的网站容易被视障人士使用。不要相信你所读的一切。,)

DISCLAIMER:

免责声明:

My argument above is largely dependent on how you define "graceful degradation." If you mean all the links still work, that's one thing, but if you mean all the links still work and so does the wombats game, that's another. I'm not trying to argue for making your site so JS dependent that non-JS users can't access any portion of it. I am trying to make an argument for the acceptability of certain features, even some core features, being reliant on JS.

我上面的观点很大程度上取决于你如何定义“优雅降级”。如果你的意思是所有的链接仍然有效,那是一回事,但是如果你的意思是所有的链接仍然有效,袋熊游戏也一样,那是另一回事。我并不是说让你的网站变得如此依赖JS,以至于非JS用户无法访问它的任何部分。我正试图论证某些特性的可接受性,甚至一些核心特性,是否依赖于JS。

#4


6  

It is relevant and it will be relevant even after 10-20 years when javascript might be supported everywhere. making things work without javascript is important development technique because it forces you to keep things simple and declarative. ideally javascript should be used only to enhance experience but your website shouldn't depend on it.

它是相关的,即使是在javascript被广泛支持的10-20年后,它仍然是相关的。在没有javascript的情况下工作是一项重要的开发技术,因为它迫使您保持简单和声明性。理想的javascript应该只用于增强体验,但是你的网站不应该依赖它。

there is clear advantage from maintenance point of view to have most of the code in declarative format (html+css) and as little as possible in imperative (javascript).

从维护的角度来看,使用声明式格式(html+css)和命令式格式(javascript)的代码越少越有明显的优势。

#5


4  

My position:

我的位置:

I browse with NoScript, so if I come on your site it will be without benefit of Javascript. I don't expect the full user experience.

我使用NoScript进行浏览,所以如果我访问您的站点,它将没有Javascript的好处。我不期望有完整的用户体验。

What I want, before turning on JS, is to be assured that you're reasonably competent and not malicious, and that I actually want what you're using JS for.

在打开JS之前,我想要的是确保您的能力是合理的,而不是恶意的,并且我确实希望您使用JS的目的是什么。

This means that, if you actually want me to use your site, you should allow me to look around, using links. (If I see a site that's totally useless without Javascript, I generally think the designers were incompetent.) You should let me know what sort of functionality I'll get from enabling Javascript, and you should present the site in a legitimate-seeming way.

这意味着,如果你真的想让我使用你的网站,你应该允许我浏览,使用链接。(如果我看到一个没有Javascript的网站是完全没用的,我通常认为设计者是不称职的。)您应该让我知道通过启用Javascript我将获得什么样的功能,并且您应该以一种看上去合理的方式呈现站点。

I don't think that's too much to ask.

我认为这没什么好问的。

#6


3  

graceful degadation / progressive enhancement / unobstusive javascript is absolutely relevant!

优雅的degadation /渐进式增强/简洁的javascript绝对相关!

as with all accessability issues: just imagine for one second what it's like to be the one on the outside who can't use the page.

就像所有的accessability问题一样:想象一下,当一个人在外面不能使用这个页面的时候是什么样子。

imagine you're travelling around the world, you're in some hotel or internet café with really old computers, old software, old browsers, you want to look up your flight and you realize you can't because of some javascript incompatability in the old browser you're using. (try 'old mobile phone' or 'stuck behind a corporate firewall' for different scenarios)

想象一下,你正在环游世界,你在某个酒店或网吧里,有真正的旧电脑,旧的软件,旧的浏览器,你想要查找你的航班,你意识到你不能因为你正在使用的旧浏览器的javascript不兼容。(对于不同的场景,可以试试“旧手机”或“被困在公司防火墙后”)

image what a world of possibilities opend up to blind people with screen readers and the web, and image what it's like to find these possibilties closed again because of javascript.

想象一下,这个充满各种可能性的世界最终会让人们对屏幕阅读器和网络视而不见,想象一下,由于javascript的存在,这些可能性又被关闭了。

so much for appealing to your better nature.

这就是吸引你的天性。

you might also want to do it to keep your site accessibly for search engines.

您可能还想这样做,以保持您的网站可访问搜索引擎。

#7


3  

Yes, it's relevant. Mobile browsers in use today do not all have Javascript enabled. It's available on new phones, sure. But there are millions and millions of people like me, who have phones running older browsers, and for all of us, a JS-required browsing experience is just plain broken.

是的,这是相关的。目前使用的移动浏览器并不是都支持Javascript。当然,新手机上也有。但是有千百万像我这样的人,他们的手机运行的是更老的浏览器,对我们所有人来说,js要求的浏览体验是完全失效的。

I don't even bother visiting sites that didn't have progressive enhancement in mind when they coded. I'm not technically behind the times. My phone is a year old. But I'm not going to re-up my contract and buy a new phone because of a crippled web experience.

我甚至懒得去访问那些在编写代码时没有渐进增强的网站。从技术上讲,我没有落后于时代。我的手机有一年了。但我不会因为网络体验不佳而重新签订合同,买一部新手机。

#8


2  

It depends on who your target audience is. I have JavaScript turned off by default and turn it on when I know what the site's intent is.

这取决于你的目标受众是谁。我在默认情况下已经关闭了JavaScript,当我知道站点的意图时就会打开它。

#9


2  

It's generally much faster to browse with Javascript disabled (digg.com is lightning without JS), which is why it's popular.

禁用Javascript的浏览速度通常要快得多(digg.com是没有JS的闪电),这就是它流行的原因。

In Opera it's really easy: you simply press F12 and untick the javascript option. I always browse without Flash, Java (not javascript), animated images and sound. I enable Flash on a per-site basis, eg YouTube. Sometimes I turn off JS temporarily if my system is slowing down.

在Opera中,这非常简单:只需按F12并取消javascript选项。我总是浏览没有Flash, Java(不是javascript),动画图像和声音。我在每个站点上启用Flash(如YouTube)。有时,如果我的系统慢下来,我会暂时关闭JS。

And don't forget about:

不要忘记:

  • Screen readers (I think they mostly have JS disabled)
  • 屏幕阅读器(我认为它们大多有JS禁用)
  • Text browsers or other very old systems
  • 文本浏览器或其他非常古老的系统
  • Ad blockers (if your filename happens lands under their radar)
  • 广告拦截器(如果你的文件名出现在他们的雷达下)
  • Any old browser that either doesn't support JS at all or the JS breaks (e.g. IE6 doesn't support some modern JS stuff).
  • 任何旧的浏览器都不支持JS或者JS中断(例如,IE6不支持一些现代的JS)。

The solution is to use progressive enhancement rather than graceful degradation, i.e. start with the basic HTML and add CSS. Then add Javascript and/or AJAX to parts of the site.

解决方案是使用渐进式增强,而不是优雅的降级,即从基本的HTML和添加CSS开始。然后将Javascript和/或AJAX添加到站点的部分。

For example, if you had a site like Stack Overflow, voting up an answer could submit a form normally. If JS is enabled, it would do an AJAX request, update the vote count and cancel the form submission, without leaving the page. SO doesn't do this though...

例如,如果您有一个像Stack Overflow这样的站点,投票一个答案通常可以提交一个表单。如果启用了JS,它将执行AJAX请求、更新选票计数并取消表单提交,而不需要离开页面。所以不要这么做…

#10


2  

I for one always have NoScript turned on unless I trust the site for a number of reasons including cross-site-scripting, click jacking, and HTML injection. It's not me being paranoid, it's because I know a lot of developers, and know most of them have no idea what web security is, never mind how to avoid vulnerabilities.

我总是没有打开任何脚本,除非出于许多原因我信任这个站点,包括跨站点脚本、单击jacking和HTML注入。这并不是我的偏执,而是因为我认识很多开发人员,他们中的大多数人都不知道什么是web安全,更别提如何避免漏洞了。

So until I trust a site there's no chance I'd let it do anything fancy.

所以,除非我相信一个网站,否则我不会让它做任何想象的事情。

For the unfamiliar, there are some interesting blog entries on the subject:

对于不熟悉的人,有一些关于这个话题的有趣的博客条目:

#11


1  

I'm going to have to make a case for the other side here. Peoples reasons for designing sites without javascript are largely idealistic. Given an enough time and money and the goal is achievable and will certainly open your website to the largest possible number of people. However in reality doing this will slow your development, increase the number of test cases that you have to deal with, and ultimately affect the quality of your application for those users that do use javascript.

我要为另一边做一个例子。人们设计网站而不使用javascript的理由在很大程度上是理想化的。只要有足够的时间和金钱,目标是可以实现的,并且一定会向尽可能多的人开放你的网站。然而,实际上这样做会减慢开发速度,增加必须处理的测试用例的数量,并最终影响使用javascript的用户的应用程序质量。

In my opinion it is perfectly reasonable to choose to make your site only compatible with js enabled browsers and tell those users that dont have it that they are missing out. This allows you to concentrate on creating rich content that the majority of users will be able to view.

在我看来,让你的网站只与支持js的浏览器兼容是完全合理的,并告诉那些没有js的用户他们正在错过。这使您可以专注于创建大多数用户都能看到的丰富内容。

There are of course exceptions to this rule, but if you are looking to create a good website for the majority of users, or have a client who is after a flashy website with limited time or money then taking the decision that it is js enabled browsers only is a reasonable thing to do.

当然有例外,但如果你想创建一个好网站对于大多数用户来说,或有一个客户是一个浮华的网站有限的时间或金钱然后决定只是js启用浏览器是一个合理的事情。

#12


0  

The real question is not whether it is relevant, but whether to use Graceful Degradation, or Progressive Enhancement as your scripting strategy.

真正的问题不在于它是否相关,而在于是否将优雅的降级或渐进的增强作为脚本策略。

#13


0  

I'm actually in an interesting position when it comes to graceful degradation of JS. I'm working on a web application that bots and crawlers have absolutely no business looking into. There's nothing they can gleam that should be indexed.

当谈到优美的JS降级时,我实际上处于一个有趣的位置。我正在开发一个web应用程序,机器人和爬虫绝对没有必要去研究它。他们没有任何东西可以被索引。

The informational site accompanying the web application, however, should be indexed, and therefore JS degrades gracefully there.

但是,与web应用程序相关的信息性站点应该被编入索引,因此JS在那里可以很好地降级。

In the web application, if you don't have JavaScript enabled, you're probably not supposed to be there. It's intended to be a rich interactive experience. The web application actually requires JS to be enabled, and for you not to be sitting behind a corporate firewall.

在web应用程序中,如果没有启用JavaScript,您可能不应该出现在那里。这是一个丰富的互动体验。web应用程序实际上需要启用JS,并且不需要坐在公司防火墙后面。

We're not serving anything malicious, its just our intent and purpose for the web application that's different. The goals of our web application and those of our informational site are completely different.

我们并不是在服务任何恶意的东西,它只是我们对web应用程序的意图和目的不同。我们的web应用程序和我们的信息性站点的目标完全不同。

#14


-1  

If you don't want the page to work when Javascript is off then just have that be the message in html, and if javascript is on, by using unobtrusive javascript you can get rid of that message and make visible the rest of the application.

如果不希望页面在Javascript关闭时正常工作,那么只需让它成为html中的消息,如果Javascript打开了,通过使用不显眼的Javascript,您可以删除该消息,并使应用程序的其余部分可见。

Depending on what you write for, in terms of javascript version, you may need to degrade if the browser the user has doesn't not have the latest version, so gracefully handling that is also important.

根据所编写的javascript版本,如果用户没有最新版本的浏览器,您可能需要降级,因此优雅地处理这一点也很重要。

#1


17  

Yes. Your web pages aren't just consumed by people: they're consumed by search engines, and crawlers, and screenscrapers. Most of those automatic tools don't support Javascript, and essentially none are going to generate UI events or look at deeply nested AJAX data. You want to have a simple static HTML fallback, if nothing else then so that your web pages are well indexed by the search engines.

是的。您的web页面不仅被人们使用:它们被搜索引擎、爬虫和屏幕抓取器使用。大多数自动工具不支持Javascript,基本上没有一个工具会生成UI事件或查看深度嵌套的AJAX数据。您希望有一个简单的静态HTML回退,如果没有别的,那么您的web页面就会被搜索引擎索引。

Forget the crazies who disable Javascript; think of the robots!

忘记那些禁用Javascript的疯子;认为机器人!

#2


13  

Yes.

People can (and do) browse with javascript disabled. If your site will work without users having to explicitly enable javascript for you, that makes them happy.

人们可以(也可以)在禁用javascript的情况下进行浏览。如果您的站点不需要用户为您显式地启用javascript,这将使他们感到高兴。

Exactly how relevant depends on your target audience, of course.

当然,确切的相关性取决于你的目标受众。

#3


11  

I would argue that you shouldn't go significantly out of your way to accommodate for non-JS users for the following reasons:

我认为,您不应该为了满足非js用户的需要而做出很大的努力,原因如下:

  • All Modern Browsers Support JS

    所有现代浏览器都支持JS

    This is a snapshot of browser usage today:

    这是今天浏览器使用的快照:

    http://www.w3schools.com/browsers/browsers_stats.asp

    http://www.w3schools.com/browsers/browsers_stats.asp

    Even the oldest common browser, IE6, supports basic JavaScript and AJAX. If you decide not to integrate certain features b/c of a JS dependence, this proves that you are essentially doing it for people who started with JavaScript enabled and explicitly chose to disable it. I think these people should expect for some features, and perhaps even entire sites, not to work as a consequence.

    甚至最古老的通用浏览器IE6也支持基本的JavaScript和AJAX。如果您决定不集成依赖于JS的某些特性b/c,这证明您实际上是在为启用JavaScript并明确选择禁用它的人做这件事。我认为这些人应该期待一些特性,甚至是整个网站,而不是因此而工作。

  • Few People Willingly Disable JS

    很少有人愿意禁用JS

    Building on my point above, average web users don't know or don't care that JS can be disabled in browsers. It's largely a tech savvy crowd who knows how to do this (myself included), and as tech savvy users we should know when to turn it back on as well.

    基于我上面的观点,一般的web用户不知道或不关心在浏览器中可以禁用JS。在很大程度上,这是一群精通技术的人,他们知道如何做到这一点(包括我自己),作为精通技术的用户,我们应该知道什么时候该把它打开。

  • Cost of Support

    成本的支持

    In light of the above, consider that choosing to accomodate users who have primarily willingly disabled JS comes with a very real cost. If you are managing a large project with heavy UI requirements, you can easily burn a lot of developer hours accommodating for what is a very small user preference. Check your budget. If it is going to take 2 devs working 40 extra hours each on the project to accomplish this feat, you are easily going to burn a few thousand dollars on what is essentially a non-issue for the vast majority of your users. How about using that time and investment to further buff up your core competency?

    考虑到以上这些,考虑到选择满足那些主要想要禁用JS的用户的需求是有代价的。如果您正在管理一个具有大量UI需求的大型项目,您可以轻松地消耗大量开发人员的时间,以适应非常小的用户偏好。检查你的预算。如果需要2个开发人员在这个项目上多工作40个小时来完成这一壮举,那么对于绝大多数用户来说,这基本上是没有问题的。用这些时间和投资来进一步提升你的核心竞争力怎么样?

  • Precedence

    优先级

    I may very well be wrong on this, but I think it would be difficult to find major media or social sites that
    don't rely on JavaScript for some
    portion of their functionality to
    work. If major businesses that rely
    on the operation and accessibility of their site to stay in business aren't doing it, there's a good chance it's because it isn't needed.

    我很可能在这一点上错了,但我认为很难找到主要的媒体或社交网站,它们的某些功能不依赖于JavaScript。如果依赖于运营和网站可访问性来维持运营的大型企业没有这样做,很有可能是因为不需要这样做。

CAVEATS:

警告:

Know your market. Continue to build XHTML/CSS that is semantic (preferably by using the RDFa W3C recommendation). Still strive to make your sites accessible to the visually impaired. Don't believe everything you read. ;)

知道你的市场。继续构建语义的XHTML/CSS(最好使用RDFa W3C推荐标准)。仍然努力使你的网站容易被视障人士使用。不要相信你所读的一切。,)

DISCLAIMER:

免责声明:

My argument above is largely dependent on how you define "graceful degradation." If you mean all the links still work, that's one thing, but if you mean all the links still work and so does the wombats game, that's another. I'm not trying to argue for making your site so JS dependent that non-JS users can't access any portion of it. I am trying to make an argument for the acceptability of certain features, even some core features, being reliant on JS.

我上面的观点很大程度上取决于你如何定义“优雅降级”。如果你的意思是所有的链接仍然有效,那是一回事,但是如果你的意思是所有的链接仍然有效,袋熊游戏也一样,那是另一回事。我并不是说让你的网站变得如此依赖JS,以至于非JS用户无法访问它的任何部分。我正试图论证某些特性的可接受性,甚至一些核心特性,是否依赖于JS。

#4


6  

It is relevant and it will be relevant even after 10-20 years when javascript might be supported everywhere. making things work without javascript is important development technique because it forces you to keep things simple and declarative. ideally javascript should be used only to enhance experience but your website shouldn't depend on it.

它是相关的,即使是在javascript被广泛支持的10-20年后,它仍然是相关的。在没有javascript的情况下工作是一项重要的开发技术,因为它迫使您保持简单和声明性。理想的javascript应该只用于增强体验,但是你的网站不应该依赖它。

there is clear advantage from maintenance point of view to have most of the code in declarative format (html+css) and as little as possible in imperative (javascript).

从维护的角度来看,使用声明式格式(html+css)和命令式格式(javascript)的代码越少越有明显的优势。

#5


4  

My position:

我的位置:

I browse with NoScript, so if I come on your site it will be without benefit of Javascript. I don't expect the full user experience.

我使用NoScript进行浏览,所以如果我访问您的站点,它将没有Javascript的好处。我不期望有完整的用户体验。

What I want, before turning on JS, is to be assured that you're reasonably competent and not malicious, and that I actually want what you're using JS for.

在打开JS之前,我想要的是确保您的能力是合理的,而不是恶意的,并且我确实希望您使用JS的目的是什么。

This means that, if you actually want me to use your site, you should allow me to look around, using links. (If I see a site that's totally useless without Javascript, I generally think the designers were incompetent.) You should let me know what sort of functionality I'll get from enabling Javascript, and you should present the site in a legitimate-seeming way.

这意味着,如果你真的想让我使用你的网站,你应该允许我浏览,使用链接。(如果我看到一个没有Javascript的网站是完全没用的,我通常认为设计者是不称职的。)您应该让我知道通过启用Javascript我将获得什么样的功能,并且您应该以一种看上去合理的方式呈现站点。

I don't think that's too much to ask.

我认为这没什么好问的。

#6


3  

graceful degadation / progressive enhancement / unobstusive javascript is absolutely relevant!

优雅的degadation /渐进式增强/简洁的javascript绝对相关!

as with all accessability issues: just imagine for one second what it's like to be the one on the outside who can't use the page.

就像所有的accessability问题一样:想象一下,当一个人在外面不能使用这个页面的时候是什么样子。

imagine you're travelling around the world, you're in some hotel or internet café with really old computers, old software, old browsers, you want to look up your flight and you realize you can't because of some javascript incompatability in the old browser you're using. (try 'old mobile phone' or 'stuck behind a corporate firewall' for different scenarios)

想象一下,你正在环游世界,你在某个酒店或网吧里,有真正的旧电脑,旧的软件,旧的浏览器,你想要查找你的航班,你意识到你不能因为你正在使用的旧浏览器的javascript不兼容。(对于不同的场景,可以试试“旧手机”或“被困在公司防火墙后”)

image what a world of possibilities opend up to blind people with screen readers and the web, and image what it's like to find these possibilties closed again because of javascript.

想象一下,这个充满各种可能性的世界最终会让人们对屏幕阅读器和网络视而不见,想象一下,由于javascript的存在,这些可能性又被关闭了。

so much for appealing to your better nature.

这就是吸引你的天性。

you might also want to do it to keep your site accessibly for search engines.

您可能还想这样做,以保持您的网站可访问搜索引擎。

#7


3  

Yes, it's relevant. Mobile browsers in use today do not all have Javascript enabled. It's available on new phones, sure. But there are millions and millions of people like me, who have phones running older browsers, and for all of us, a JS-required browsing experience is just plain broken.

是的,这是相关的。目前使用的移动浏览器并不是都支持Javascript。当然,新手机上也有。但是有千百万像我这样的人,他们的手机运行的是更老的浏览器,对我们所有人来说,js要求的浏览体验是完全失效的。

I don't even bother visiting sites that didn't have progressive enhancement in mind when they coded. I'm not technically behind the times. My phone is a year old. But I'm not going to re-up my contract and buy a new phone because of a crippled web experience.

我甚至懒得去访问那些在编写代码时没有渐进增强的网站。从技术上讲,我没有落后于时代。我的手机有一年了。但我不会因为网络体验不佳而重新签订合同,买一部新手机。

#8


2  

It depends on who your target audience is. I have JavaScript turned off by default and turn it on when I know what the site's intent is.

这取决于你的目标受众是谁。我在默认情况下已经关闭了JavaScript,当我知道站点的意图时就会打开它。

#9


2  

It's generally much faster to browse with Javascript disabled (digg.com is lightning without JS), which is why it's popular.

禁用Javascript的浏览速度通常要快得多(digg.com是没有JS的闪电),这就是它流行的原因。

In Opera it's really easy: you simply press F12 and untick the javascript option. I always browse without Flash, Java (not javascript), animated images and sound. I enable Flash on a per-site basis, eg YouTube. Sometimes I turn off JS temporarily if my system is slowing down.

在Opera中,这非常简单:只需按F12并取消javascript选项。我总是浏览没有Flash, Java(不是javascript),动画图像和声音。我在每个站点上启用Flash(如YouTube)。有时,如果我的系统慢下来,我会暂时关闭JS。

And don't forget about:

不要忘记:

  • Screen readers (I think they mostly have JS disabled)
  • 屏幕阅读器(我认为它们大多有JS禁用)
  • Text browsers or other very old systems
  • 文本浏览器或其他非常古老的系统
  • Ad blockers (if your filename happens lands under their radar)
  • 广告拦截器(如果你的文件名出现在他们的雷达下)
  • Any old browser that either doesn't support JS at all or the JS breaks (e.g. IE6 doesn't support some modern JS stuff).
  • 任何旧的浏览器都不支持JS或者JS中断(例如,IE6不支持一些现代的JS)。

The solution is to use progressive enhancement rather than graceful degradation, i.e. start with the basic HTML and add CSS. Then add Javascript and/or AJAX to parts of the site.

解决方案是使用渐进式增强,而不是优雅的降级,即从基本的HTML和添加CSS开始。然后将Javascript和/或AJAX添加到站点的部分。

For example, if you had a site like Stack Overflow, voting up an answer could submit a form normally. If JS is enabled, it would do an AJAX request, update the vote count and cancel the form submission, without leaving the page. SO doesn't do this though...

例如,如果您有一个像Stack Overflow这样的站点,投票一个答案通常可以提交一个表单。如果启用了JS,它将执行AJAX请求、更新选票计数并取消表单提交,而不需要离开页面。所以不要这么做…

#10


2  

I for one always have NoScript turned on unless I trust the site for a number of reasons including cross-site-scripting, click jacking, and HTML injection. It's not me being paranoid, it's because I know a lot of developers, and know most of them have no idea what web security is, never mind how to avoid vulnerabilities.

我总是没有打开任何脚本,除非出于许多原因我信任这个站点,包括跨站点脚本、单击jacking和HTML注入。这并不是我的偏执,而是因为我认识很多开发人员,他们中的大多数人都不知道什么是web安全,更别提如何避免漏洞了。

So until I trust a site there's no chance I'd let it do anything fancy.

所以,除非我相信一个网站,否则我不会让它做任何想象的事情。

For the unfamiliar, there are some interesting blog entries on the subject:

对于不熟悉的人,有一些关于这个话题的有趣的博客条目:

#11


1  

I'm going to have to make a case for the other side here. Peoples reasons for designing sites without javascript are largely idealistic. Given an enough time and money and the goal is achievable and will certainly open your website to the largest possible number of people. However in reality doing this will slow your development, increase the number of test cases that you have to deal with, and ultimately affect the quality of your application for those users that do use javascript.

我要为另一边做一个例子。人们设计网站而不使用javascript的理由在很大程度上是理想化的。只要有足够的时间和金钱,目标是可以实现的,并且一定会向尽可能多的人开放你的网站。然而,实际上这样做会减慢开发速度,增加必须处理的测试用例的数量,并最终影响使用javascript的用户的应用程序质量。

In my opinion it is perfectly reasonable to choose to make your site only compatible with js enabled browsers and tell those users that dont have it that they are missing out. This allows you to concentrate on creating rich content that the majority of users will be able to view.

在我看来,让你的网站只与支持js的浏览器兼容是完全合理的,并告诉那些没有js的用户他们正在错过。这使您可以专注于创建大多数用户都能看到的丰富内容。

There are of course exceptions to this rule, but if you are looking to create a good website for the majority of users, or have a client who is after a flashy website with limited time or money then taking the decision that it is js enabled browsers only is a reasonable thing to do.

当然有例外,但如果你想创建一个好网站对于大多数用户来说,或有一个客户是一个浮华的网站有限的时间或金钱然后决定只是js启用浏览器是一个合理的事情。

#12


0  

The real question is not whether it is relevant, but whether to use Graceful Degradation, or Progressive Enhancement as your scripting strategy.

真正的问题不在于它是否相关,而在于是否将优雅的降级或渐进的增强作为脚本策略。

#13


0  

I'm actually in an interesting position when it comes to graceful degradation of JS. I'm working on a web application that bots and crawlers have absolutely no business looking into. There's nothing they can gleam that should be indexed.

当谈到优美的JS降级时,我实际上处于一个有趣的位置。我正在开发一个web应用程序,机器人和爬虫绝对没有必要去研究它。他们没有任何东西可以被索引。

The informational site accompanying the web application, however, should be indexed, and therefore JS degrades gracefully there.

但是,与web应用程序相关的信息性站点应该被编入索引,因此JS在那里可以很好地降级。

In the web application, if you don't have JavaScript enabled, you're probably not supposed to be there. It's intended to be a rich interactive experience. The web application actually requires JS to be enabled, and for you not to be sitting behind a corporate firewall.

在web应用程序中,如果没有启用JavaScript,您可能不应该出现在那里。这是一个丰富的互动体验。web应用程序实际上需要启用JS,并且不需要坐在公司防火墙后面。

We're not serving anything malicious, its just our intent and purpose for the web application that's different. The goals of our web application and those of our informational site are completely different.

我们并不是在服务任何恶意的东西,它只是我们对web应用程序的意图和目的不同。我们的web应用程序和我们的信息性站点的目标完全不同。

#14


-1  

If you don't want the page to work when Javascript is off then just have that be the message in html, and if javascript is on, by using unobtrusive javascript you can get rid of that message and make visible the rest of the application.

如果不希望页面在Javascript关闭时正常工作,那么只需让它成为html中的消息,如果Javascript打开了,通过使用不显眼的Javascript,您可以删除该消息,并使应用程序的其余部分可见。

Depending on what you write for, in terms of javascript version, you may need to degrade if the browser the user has doesn't not have the latest version, so gracefully handling that is also important.

根据所编写的javascript版本,如果用户没有最新版本的浏览器,您可能需要降级,因此优雅地处理这一点也很重要。