假设大多数用户都启用了JS,安全性如何? [英] How safe is it to assume that most users will have JS enabled?

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

问题描述


可能重复:

假设我的访问者启用了javascript是否合理?

有多少人禁用JavaScript?

我知道JS应仅用于增强功能,禁用JS的用户仍应能够使用您的网站。但现在这种情况经常发生多少次?大多数现代Web 2.0页面需要JS来增加功能。

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.

换句话说,假设大多数用户都启用了JS,有多安全?

有没有人有具体的数据?

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?

推荐答案

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

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.

总而言之,您应该尝试仅将JS用于渐进增强。该网站的设计应与其提供的方式相同,并且在禁用JS的情况下保持相同的功能。实现这一目标的最佳方法是在没有任何JS代码的情况下构建网站,并且当您获得所有必需的最低功能时,然后添加JS以获得诸如ajax,eye-candiness,用户体验等增强功能。

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.

值得注意的是,这当然可能取决于相关网站的目标受众。这是一个新闻网站吗?社交网站?内联网网站?讨论论坛?等等。例如,Stackoverflow在禁用JS的Blackberry上无法使用。我甚至无法登录。但它会在顶部正常显示警告栏。

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天全站免登陆