We explain in easy to understand terms, how you can write cookies
An easy to follow guide to reading cookies you have set
Cookies cannot be deleted directly from a web page, you have to ‘expire’ them so that the browser can delete them for you
Here we will give a basic overview on how to delete a cookie that you set from a page on your site, from the same or another page on your site.
Place this script in the <head> section of your page:
Then you can use the following code to read the cookie:
Deleting a Cookie is easy, you just write it again with an expiry date in the past. The cookie must have been written by a page on your site. You cannot delete cookies written by other sites.
To delete a cookie called ‘MyCookie’ that you wrote earlier with a value of ‘I have been here’ and an expiry date in the future.
Simply use SetCookie(‘MyCookie’,’Deleted’,-1); (The value ‘Deleted’ can be anything you like it’s gonna disappear when the browser closes anyway).
The expiry date is set to -1 (24 hours ago) so when the browser closes the cookie will be deleted by the browser automatically.
You can also delete cookies with ASP and PHP scripts. (PHP scripts not covered here at present)
To delete a cookie called UserInfo in ASP, use something like:
Response.Cookies(“UserInfo”).Expires = Date() -1 (Expiry date set to 24 hours ago)
|Writing Cookies on Your Site|
|Reading Cookies on Your Site|
|Deleting Cookies on Your Site|