假设大多数用户将启用 JS 有多安全? [英] How safe is it to assume that most users will have JS enabled?

查看:28
本文介绍了假设大多数用户将启用 JS 有多安全?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<块引用>

可能的重复:
假设我的访问者启用了 javascript 是否合理?
有多少人禁用 JavaScript?

我知道 JS 应该只用于增强功能,禁用 JS 的用户应该仍然可以使用您的网站.但如今这种情况真的发生的频率有多高?大多数现代Web 2.0"页面都需要 JS 来增加功能.

换句话说,假设您的大多数用户都启用了 JS 有多安全?
有没有人有这方面的具体数据?

解决方案

几乎所有的 PC/台式机/笔记本电脑用户都启用了 JS.您目前主要关注的应该是移动市场.这个增长非常快.JS 经常被(默认情况下!)禁用以提高浏览性能.然而,这是缓慢但肯定会获得更好的覆盖范围.然后是屏幕阅读器和基于文本的浏览器,当然还有搜索机器人.实际上,他们都不支持/使用 JS.然而,对于搜索机器人,这可能会在未来发生变化.

总而言之,您应该尝试仅将 JS 用于渐进式增强.网站的设计方式应该是在禁用 JS 的情况下提供和维护相同的功能.实现这一目标的最佳方法是在没有任何 JS 代码行的情况下构建网站,并且当您获得所有所需的最低功能时,然后添加 JS 以实现 ajax、美观、用户体验等增强功能.

应该注意的是,这当然可能取决于相关网站的目标受众.是新闻网站吗?社交网站?内网网站?讨论区?等等.例如 Stackoverflow 在禁用 JS 的情况下无法在我的 Blackberry 上使用.我什至无法登录.然而,它在顶部优雅地显示了一个警告栏.

Possible Duplicates:
Is it reasonable to assume my visitors have javascript enabled?
How many people disable JavaScript?

I know that JS should only be used to enhance functionality and users with JS disabled should still be able to use your website. But how often does that really happen nowadays? A majority of modern "Web 2.0" pages need JS for added functionality.

In other words, how safe is it to assume that most of your users will have JS enabled?
Does anyone have concrete data on this?

解决方案

Practically all of the PC/desktop/laptop users have JS enabled. Your current major concern should be the mobile market. This is growing very fast. More than often JS is (by default!) disabled to improve browsing performance. This is however slowly but surely getting a better coverage. Then there are screenreaders and textbased browsers and of course searchbots. Practically none of them supports/uses JS. With regard to searchbots, this can however change in the future.

All with all, you should try to use JS only for progressive enhancements. The website should be designed the way that it provides and maintains the same functionality with JS disabled. The best way to achieve this would be building the website without any line of JS code and when you got all the minimum required functionality to function, then add JS for the enhancements like ajax, eye-candiness, user experience and so on.

Noted should be that this may of course depend on the target audience of the website in question. Is it a news site? Social networking site? Intranet site? Discussion forum? Etcetera. Stackoverflow for example is unusable on my Blackberry with JS disabled. I can't even login. It is however gracefully displaying a warning bar in top.

这篇关于假设大多数用户将启用 JS 有多安全?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆