1

How to clear cookies with out keeping any expiry time.

i have created a cookie like this

document.cookie = "visited=yes";

i need to remove this cookie.

How can i do that..?

Thanks in advance

K D
  • 5,725
  • 1
  • 21
  • 33
Jayababu
  • 1,631
  • 1
  • 12
  • 27

1 Answers1

0

Usually you would just update your cookies expiry time to delete it.

document.cookie = "expires=Thu, 01 Jan 1970 00:00:00 GMT";

You can also write an empty cookie to reset it's values:

document.cookie = "key=";

http://www.w3schools.com/js/js_cookies.asp

Michel Feldheim
  • 16,877
  • 5
  • 56
  • 77