如何检查客户端浏览器中是否启用了javascript? [英] how can i check whether javascript is enabled or disabled in client browser?

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

问题描述



正在用php创建网页.我想知道客户端浏览器中是启用还是禁用了JavaScript.

guyz,请您帮我解决这个问题.



am creating a webpage in php. i want to know whether javascript is enabled or disabled in client side browser.

guyz, will you please help me to solve this problem.

推荐答案

尝试以下方法:

http://techpatterns.com/downloads/javascript_browser_detection.php [ http://hungred.com/how-to/determine-whether -javascript-is-enabled-disabled-via-php/ [
Try these:

http://techpatterns.com/downloads/javascript_browser_detection.php[^]

http://hungred.com/how-to/determine-whether-javascript-is-enabled-disabled-via-php/[^]

hope it helps :)


您的问题似乎很明确,但实际上可能并非如此.原因如下:您想如何使用此功能?如果希望有一个JavaScript函数,如果在浏览器中禁用了JavaScript,则该函数返回false,请考虑一下:它永远不会被调用,因为……好吧,因为禁用了JavaScript. :-)它总是返回true或不被调用. :-)

而且,没有任何可靠的方法可以在服务器端使用PHP进行检查.这件事不是任何标准协议的一部分.例如,请参见:
http://www.codingforums.com/showthread.php?t=138190 [< ^ ].

因此,您所能做的就是使用HTML noscript http://www.w3schools.com/tags/tag_noscript.asp [ ^ ].

—SA
It looks like your question is very clear, but in fact it is probably not. Here is why: How you want to use this feature? If you hoped to have a JavaScript function which returns false if JavaScript is disabled in the browser, think about it: it will never be called because… well, because JavaScript is disabled. :-) It would always return true or not called. :-)

And there is no any reliable way to check it on server side with PHP. This matter is just not a part of any standard protocol. For example, see this: http://www.codingforums.com/showthread.php?t=138190[^].

So, all you can do is using HTML noscript, http://www.w3schools.com/tags/tag_noscript.asp[^].

—SA


这篇关于如何检查客户端浏览器中是否启用了javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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