views:

70

answers:

2

Hello

On a very first access to a website, is it possible to know if browser cookies are activated thanks to the GET request?

Is it possible particularly in a J2EE context? On the server side (no ajax/js solution)

+6  A: 

Short answer: No.

The HTTP request does simply not carry that kind of information. It's only implicitly testable by trying to send one to the client and see if it uses it or not. There are probably also various javascript options, but you explicitly did not want one of those.

roe
+1 Sadly, this is true. Be kind of nice if there were an `Accept-Cookie` header along the lines of the `Accept`, `Accept-Encoding`, `Accept-Language`, etc. headers. http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html But there isn't. :-(
T.J. Crowder
thanks that's what i though :(
Sebastien Lorber
+3  A: 

you can send cookies with first page, and then redirect to some index. if anyone tries to get page other then first without cookies then it is not supporting it.

Andrey
interesting solution, not the first access, but close enough, +1
roe
**Very first accesss** he said.
T.J. Crowder
@T.J. Crowder: so i have a bad news for him. HTTP is session-less protocol, and there is no "first", "second" or any other defined access. so i suggest to count "access to first page" as "first access"
Andrey
Would browsers accept cookies in 302 responses? That could be a good compromise, invisible to the user. It wouldn't catch someone accessing the second page directly of course (bookmarks, links via email/facebook/whatever), so if that's a deal breaker, he's out of luck.
roe