• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Deleting Cookies

The browser will delete cookies when they’re expired (although it might take the browsers a little time to do so). That means we can delete cookie1 just by resetting its expiration time. Here’s a function, deleteCookie, which does exactly that, setting the cookie’s expiration date to some time in the past:

function deleteCookie() 
{ 
    document.cookie = 
        "cookie1=Here is the cookie data!;expires=Fri, 31 Dec 1999 23:00:00 GMT;" 
        document.form1.text1.value = "" 
        window.alert("Cookie will be deleted!") 
} 

					  


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint