[Javascript] Re: Detect Cookies? (Slightly OT now)

Ben Curtis Quixote at LaMancha.org
Fri Aug 17 12:02:33 CDT 2001


> Is this a valid script to use to detect and
> then redirect?
> -------------------------
> %@LANGUAGE="vbscript"%>
> <% response.buffer="true" %>
> <html><head>
> <%
> Set browser = Server.CreateObject("MSWC.BrowserType")
> %>
> <%
> if browser.cookies = false then
> response.redirect "nocookies.asp"
> else
> response.redirect "region.asp"
> end if
> %>
> </head><body></body>
> </html>


This script is only testing if a browser is capable of storing cookies, and
does not check if the user has set preferences to deny them. Far better to
set a cookie and test if it exists. If you do this server-side, then you
need to do it on subsequent http calls -- two different pages (one sets, the
other tests) or something tricky with one page setting it and calling an
image that tests it.

Javascript makes it much easier.

--
+Ben Curtis

"Most people use statistics the way a drunkard uses a lamp post,
more for support than illumination."









More information about the Javascript mailing list