如何检测用户是否禁用了JavaScript? [英] How to detect if a user had javascript disabled?

查看:55
本文介绍了如何检测用户是否禁用了JavaScript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在和一个朋友谈论有关在浏览器中未启用javascript的用户,以及如何向他们显示您网站的非javascript"版本.

I was talking with a friend about users who do not have javascript enabled in their browser and what could be done to show them a "no-javascript" version of your website.

有可能吗?怎么做?

有想法吗?

推荐答案

请勿尝试为网站构建单独的JS和非JS版本.生成一个非JS版本,然后使用JS进行增强.这样可以更轻松地重用代码,允许您将对象/功能检测用于 entire 堆栈,如果开发人员更新网站的一个分支而不更新另一个分支,则使没有JavaScript的用户被遗留的可能性较小.

Don't try to build separate JS and non-JS versions of the site. Build a non-JS version and then enhance it with JS. This makes it easier to reuse code, allows you to use object/feature detection for the entire stack, and makes it less likely that users without JavaScript will be left behind if developers update one branch of the site but not the other.

这篇关于如何检测用户是否禁用了JavaScript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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