对于一小部分坚持使用 NoScript 之类的用户该怎么办?

发布于 2024-10-23 13:05:06 字数 177 浏览 1 评论 0原文

我想制作一个完全基于套接字和ajax 的网站以供用户交互。这意味着关闭 JavaScript 的用户甚至无法以任何方式向网站发送更新,甚至无法注册。他们只能读取数据。

那么对此的普遍看法是什么呢?我是否应该花时间让网站足够灵活,以便能够处理一小群关闭了脚本的人?

这也是我希望能够在更多网站中重用的一个框架。

I want to make a website completely socket and ajax based for user interaction. Meaning that users who have javascript turned off won't even be able to send updates to the website in any way or even register. They'll only be able to read data.

So what's the general opinion on this? Should I take my time to make the website flexible enough to be able to deal with a small group of people who have scripts turned off?

This is also a framework that I want to be able to reuse in more websites.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

╰沐子 2024-10-30 13:05:06

你做出的每一个决定都会影响到一部分用户。
理想的屏幕尺寸、cookie 的开启或关闭、JavaScript 等都会产生影响。

但这并不新鲜。如果您为 iOS 编写应用程序,它就无法在 Android 上运行。如果您为 xBox 编写游戏,它不会在 PlayStation 上运行。

我个人的观点 - 如果人们确实在浏览器中关闭了 JavaScript(统计数据表明这是一个相当低的百分比),那么他们将获得较差的网络体验。他们将无法正确使用您的网站。国际海事组织,没关系。你已经做出了选择,他们也做出了选择。您希望您的用户获得良好的体验,因此您会专注于这一点。

让我们将其类比为 Windows 和 Mac 软件。 Windows 占据桌面市场 95% 的份额,Mac 占据 5% 的份额。 (我正在编造数字 - 确切的统计数据是什么并不重要)。因此,很自然地,您首先要为 PC 编写程序。之后,您可以花时间为 Mac 重写,或为 PC 进行改进。大多数人选择针对 PC 进行改进。

我现在在营地里,不太关心少数群体。我不再在 IE6 中进行测试。我需要启用 JavaScript。我至少需要一个会话 cookie 的支持。如果您想继续使用 IE6,那就去吧,但这是您的决定,所以如果您无法使用该网站,请不要向我哭诉。我不支持 10 年前的手机,那么为什么要支持 10 年前的浏览器呢?我理解有些人关闭 JavaScript 的逻辑 - 但我不会为了适应你而削弱其他 98% 的人的体验。而且我没有时间将所有内容重写两次。

Every decision you make will affect some portion of users.
Ideal screen size, cookies on-or-off, JavaScript and so on all have an impact.

But this is not new. If you write an app for iOS it can't run on Android. If you write a game for xBox it doesn't run on the PlayStation.

My personal opinion - if people have literally turned off JavaScript in their browser (and stats suggest this is a pretty low percentage) then they're gonna get an inferior web experience. They won't be able to properly use your site. IMO that's ok. You've made a choice and so have they. You want your users to get a good experience, and so you focus on that.

Let's make this analogous to say Windows and Mac software. Windows has say 95% of the desktop market, and Mac 5%. (I'm making up the numbers - it's not important what the exact stats are). So naturally you write your program first for PC. After that you could spend your time re-writing for Mac, or improving for PC. Most people opt to improve for PC.

I'm in the camp now where I'm not too concerned about minorities. I don't test in IE6 anymore. I require JavaScript to be on. And I need support for at least a session cookie. If you wanna stay on IE6 - go for it, but that's your decision so don't come crying to me if you can't use the site. I don't support 10 year old phones, so why support a 10 year old browser? I understand the logic for some folks turning off JavaScript - but I'm not gonna diminish the experience for the other 98% of people just to accommodate you. And I don't have time to rewrite everything twice.

时光是把杀猪刀 2024-10-30 13:05:06

由于我们对您的网站、您的商业模式、您的客户或“小”有多小一无所知,因此我们不可能向您提供是否值得的建议。这肯定会导致大量工作,并且可能会导致用户体验出现一些不一致。

为了在两者之间尽可能多地重用,您可以做的一件事是使用严格的 MVC 模型。模型层可以获取所请求的每条数据,而其前面的外观层可以为这两种请求提供服务。

假设您的网站有一个会员个人资料管理页面。该模型有一个 Member 对象,其中包含用于设置/获取标识符、地址、电话号码、电子邮件地址等的方法。

场景 A,启用 JS:
1) 来自“配置文件管理”菜单选项的链接调用后端的 getProfile()。它构建了要通过调用 getIdentifiers()、getAddress()、getPhone() 等发回的 HTML/JavaScript,并将其发送回客户端。
2) 用户在其个人资料页面上更改电话号码。由于启用了 JS,将对 setPhone() 进行 AJAX 调用,当结果返回时,仅更新页面的该部分。

场景B,JS被禁用:
1) 来自“配置文件管理”菜单选项的链接调用后端的 getProfile()。会话数据将有一个布尔值,表明 JS 已禁用,因此呈现的页面具有表单和提交按钮。
2) 用户向setProfile()提交数据,包含所有字段,无论是否更改。返回的是通过 getProfile() 使用新信息重新渲染页面。

另请参阅这篇文章有关演示的信息JS关闭时的替代内容。

所以这是可能的。然而,正如布鲁斯所说,除非你真的需要这些人口,否则他们会得到他们应得的。我个人不会付出这样的努力,就像我不会尝试考虑可能尝试通过 14.4K 调制解调器访问该网站的用户一样。所有这些关闭 JS 的工具都允许您指定例外网站。

Since we don't know anything about your website, your business model, your customers, or how small "small" is, it would be impossible for us to advise you on whether it's worth it or not. It would certainly lead to a lot of work, and probably some inconsistencies in the user experience.

One thing you can do to reuse as much as possible between the two would be to use a strict MVC model. The model layer can fetch each piece of data asked for, while the facade layer in front of it can service both kinds of requests.

Let's say your website has a member profile admin page. The model has a Member object with methods for setting/getting identifiers, address, phone number, email address, etc.

Scenario A, JS is enabled:
1) A link from the "profile admin" menu option calls getProfile() on the back end. That builds the HTML/JavaScript to send back by calling getIdentifiers(), getAddress(), getPhone(), etc. and sends that back to the client.
2) The user changes the phone number on their profile page. Since JS is enabled, an AJAX call will be made to setPhone(), and when the results come back, only that portion of the page is updated.

Scenario B, JS is disabled:
1) A link from the "profile admin" menu option calls getProfile() on the back end. The session data will have a boolean noting that JS is disabled, so the page that's rendered has forms and submit buttons.
2) User submits data to setProfile(), containing all the fields, changed or not. What's send back is a re-rendering of the page with the new info via getProfile().

Also see this post about presenting alternate content when JS is turned off.

So it is possible. However, as Bruce said, unless you REALLY need that population, they get what they deserve. I personally would not go through that level of effort, any more than I would try to account for users who might try to access the site through 14.4K modems. All of these tools to turn off JS allow you to specify exception websites.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文