PDA

View Full Version : Detecting cookie disabled browsers


karolmcauley
10-03-2002, 03:25 PM
Would the code below suffice to detect whether a user/client computer has cookies disabled?? Does anyone have or know of "other" scripts that do this?

' set cookie value
Response.Cookies("surname") = username

'check if cookie is enabled
if (Request.Cookies("surname")<>username) then
response.write("You need to enable cookies.")
response.end
end if

many Thx in advance

whammy
10-04-2002, 02:02 AM
I don't see why that wouldn't suffice. That's about as simple as you can get. And simplicity in my book equals elegance. :D

Just test it out if you're not sure (although it looks pretty "solid" to me).

Disable cookies in your browser and then surf to the page where you are using the code. If the cookie value is not read, then do a Response.Write...

Response.Write("I didn't know you hated cookies. That's a shame. Some of them like my Great Uncle's are really tasty!")

:D

glenngv
10-04-2002, 02:16 AM
that code seems familiar to me.
you deleted the thread where i posted that code.:D

as whammy said, it should work.:)