3 Answers
3

There are explanations that can be found by doing a search on Google most use an AJAX call or a hidden field that gets popluated via some javascript, that won't get run if Javascript is disabled.

If you have to do it then I'd try doing it on the very first request from the client, and save a cookie (or somethign similar), then check the value of the cookie on subsequent requests. This assumes that the user doesn't enable / disable Javascript often. You could also store a value in the session.

Page.Request.Browser.EcmaScriptVersion will indicate what ASP.NET thinks is true. This assumes that the BrowserCaps are correct. It does give you a first pass indication which is probably pretty close.

EDIT: I initially misunderstood the question (enabled vs. supported). You could use the BrowserCaps server side to weed out those UserAgents that don't support JavaScript. Then use one line of script on each request to determine if it is enabled via cookie: