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,889
  • 1
  • 23
  • 35
Jayababu
  • 1,641
  • 1
  • 14
  • 30

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
  • 17,625
  • 5
  • 60
  • 77