如何检查C#中启用或禁用JavaScript [英] How to check JavaScript is enabled or disabled in C#

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

问题描述

大家好,

如何在服务器端的浏览器中检测到启用或禁用了JavaScript?
我在Google中搜索并找到了以下代码.

Hi all,

How can I detect that javaScript is enabled or disabled in browser at Server side ?
I searched in google and found the code below.

HttpBrowserCapabilities httpBrowser = Request.Browser;

bool enableJavascript = httpBrowser.JavaScript; // return true if Javascript enabled in client Browser



但是此代码无法正常工作.
httpBrowser.JavaScript始终返回true.

请帮忙.
谢谢...



But this code is not working.
httpBrowser.JavaScript always returns true.

Please help.
Thanks...

推荐答案

^ ]
检查是否使用用户从服务器端启用了JavaScript控制 [ ^ ]

检测在服务器端启用的Javascript [检查是否禁用了javascript? [如何检查是否启用了JavaScript [
Detect if JavaScript is enabled in ASPX[^]
Check if JavaScript is Enabled from Server-Side Using an User Control[^]

Detect Javascript enabled on server side[^]
Check if javascript is disabled?[^]

How To Check Is JavaScript Enabled[^]


此variale仅检测浏览器是否能够运行javascript,而不能检测其是否已打开.

这是我对问题的解决方案:
如何使用脚本管理器在客户端浏览器上检测JavaScript状态 [ ^ ]

这是一个固定的演示项目,可以解决其他用户遇到的问题:
使用表单提交检测浏览器的Javascript状态 [ ^ ]

如有任何疑问,请通知我.

仅供参考:此解决方案适用于所有浏览器.
This variale merely detects if a browser is capable of running javascript and not if it is turned off or on.

Heres my solution to the problem :
How to Detect JavaScript Status on the Client Browser using Script Manager[^]

Here is a fixed demo project that resolves issues other users experienced:
Detect Javascript status of browser using Form Submit[^]

Should you have any questions please let me know.

Also a quick FYI : This solution works on all browsers.


这篇关于如何检查C#中启用或禁用JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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