开发者

Is there a reliable way to detect if browser enable javascript in C#?

开发者 https://www.devze.com 2023-03-13 13:50 出处:网络
I am trying to detect if client browser suppport jav开发者_StackOverflow社区ascript using asp.net/C# code. After searching online, I found two methods:

I am trying to detect if client browser suppport jav开发者_StackOverflow社区ascript using asp.net/C# code. After searching online, I found two methods:

  1. bool enjs=Request.Browser.JavaScript
  2. int version=Request.Browser.EcmaScriptVersion.Major (it says if version grater and equal to 1, the browser support javascript)

However, after testing, I found neither of them works. No matter I turned off or turned on javascript the enjs always be true, and version always equal to

Does anyone know a method could detect if browser supports javascript? I want the asp.net/c# code. Thanks.


Use javascript to change the value of hidden form field in the page's onload event. If the new value shows up on postbacks, you have javascript.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号