File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to Check If Cookies are Enabled/Disabled

 
Somnath Mallick
Ranch Hand
Posts: 482
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

Dont know if this is already asked. Searching did not help. I was trying to implement a piece of code which checked if the cookies were enabled or disabled on the client browser. If disabled i wanted to show an error. Could you give me some pointers on how to do so? I know how to do it via JavaScript.... but wanted to implement this on the server side. Thanks for the help in advance.
 
Koen Aerts
Ranch Hand
Posts: 344
Java Linux Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the servlet use javax.servlet.http.Cookie to set/read a cookie.
 
Bosun Bello
Ranch Hand
Posts: 1510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try setting a cookie then try to read it back, and see if it's sent as part of the request.
 
Wendy Gibbons
Bartender
Posts: 1107
Eclipse IDE Oracle VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this discussion on stack overflow seems quite complete
http://stackoverflow.com/questions/531393/how-to-detect-if-cookies-are-disabled-is-it-possible
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic