This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Servlets and the fly likes Cookies Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Cookies " Watch "Cookies " New topic
Author

Cookies

Yogender Butola
Greenhorn

Joined: Jul 19, 2004
Posts: 12
I'm setting cokkies through my servlet. But before doing that, I want to confirm whether cookies are enabled in the browser or not. If cookies are not enabled, I want to display a message in the borwser to enable the cookies first.

How can I check whethere cookies are enabled or disabled by the browser?
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
I don't think you can do that except by setting a cookie and seeing if it comes back with the next request. If it does then cookies are enabled, if it doesn't then they're probably not.

Jules
James Clinton
Ranch Hand

Joined: Jun 23, 2003
Posts: 190
the alternative is URL rewriting, however exposing the session id in the request can open up security issues.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cookies
 
It's not a secret anymore!