Is there any way, via C# code, to detect whether JavaScript is enabled or disabled? If I’m using JQuery for developing a website, if JavaScript is not enabled, then what do I do? How should I handle it?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
C# has no way of determining this. C# runs on the server and sends output to the client. It has no idea if the client is capable/willing to run JavaScript.
Also, a script can never truly know this either, since it’s not executed anyway.
The only way you can “react” to disabled JavaScript would be to use a
<noscript>tag to advise your users that JavaScript is required for your site.You can see an example of this on StackOverflow. Turn off JavaScript, refresh the site, and you will see: