1 Replies - 8298 Views - Last Post: 02 August 2012 - 09:01 AM

#1 insanepenguin  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 238
  • Joined: 08-July 10

Disabling cookies with JavaScript?

Posted 02 August 2012 - 07:41 AM

Hi guys,

A friend is panicking about this cookie law thing http://www.aboutcook...lt.aspx?page=3. Is there a way, perhaps using javascript to turn off all site cookies if a user, for example, clicks a link that disables them?

It's a very basic site, static content - not even sure there are any cookies!


Is This A Good Question/Topic? 0
  • +

Replies To: Disabling cookies with JavaScript?

#2 Atli  Icon User is offline

  • Enhance Your Calm
  • member icon

Reputation: 4240
  • View blog
  • Posts: 7,216
  • Joined: 08-June 10

Re: Disabling cookies with JavaScript?

Posted 02 August 2012 - 09:01 AM


All cookies visible to the client-side are accessible through the Javascript document.cookie special property. You can interact with them there, and if you so choose, erase them all. - See details on how to do that here: quirksmode.org/js/cookies.html

There are, however, some cookies that are not accessible to Javascript. Namely the so call HttpOnly cookies. They are kept out of reach of Javascript for security reasons.

Of course, if this is your site, the simplest thing do to would be to not set the cookies in the first place. Surely you know where, and why, your site would be setting cookies? It doesn't just happen by accident.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1