There are several components which will allow you to determine if cookies or javascript are SUPPORTED. You can even do it yourself, with minimal knowledge of browser versions (and where in the dev timeline these features were introduced). But knowing whether or not they're supported is far less than half the battle: the key is to detect whether or not they're ENABLED.
There is a component that tells you whether these things are enabled (NOTE: it does NOT do this exclusively from the SERVER), and many other important facets of a unique user's browser. It's called BrowserHawk:
BrowserHawk Overview - Download your ... You can do this yourself as well, but it's a much lengthier coding process.
Cookies: Set a cookie, redirect, and try to read that cookie. If you can't, then cookies are disabled. Here is some sample code:
cookietest.asp: <% response.cookies("enabled")="1" response.redirect("cookietest2.asp") %> |
cookietest2.asp: <% if request.cookies("enabled")="1" then response.write("cookies are enabled") else response.write("cookies are not enabled") end if %> |
You can also try code like this, on any but the first page accessed:
<% cook = Request.ServerVariables("HTTP_COOKIE") if len(cook)<2 or cook="" then response.write("Your cookies are disabled.") else response.write("Your cookies are enabled.") end if %> |
JavaScript: Populate default.asp with a hidden form (with POST method, action=default2.asp) and a link to default2.asp in <noscript> tags. Use JavaScript to post to the next page, then try and read from the request.form collection. If it's empty, they used the link (and Javascript is disabled). One caution: Netscape 2.0 will execute <script> as well as <noscript>. Here is some sample code:
scripttest.asp: <form method=post action=scripttest2.asp name='hiddenform'> <input type=hidden name=enabled value="1"> </form> <form method=post action=scripttest2.asp name='visibleform'> <input type=hidden name=enabled value="0"> <input type=submit value=" Proceed >> "> </form> <script> document.hiddenform.submit(); </script>
|
scripttest2.asp: <% if request.form("enabled")="" then ' user bypassed checker response.redirect("scripttest.asp") else if request.form("enabled")="1" then response.write("scripting is enabled") else response.write("scripting is not enabled") end if end if %> |
This solution is a little messy, as most users will see the first page for an instant. However if this information is crucial to the rest of your application, it is a reasonable trade-off.