HTML and CSS Reference
In-Depth Information
Figure 16.11 When the user clicks the “See Cookie” button, all cookies are retrieved.
Figure 16.12 After the user clicks the button, the color of the page changes based
on the cookie that was sent.
16.2.5 Deleting a Cookie
If you want to delete a cookie for the current page, set the expiration date of the cookie
to a date earlier than the current date. This will cause the cookie to be deleted when the
session ends.
EXAMPLE 16.4
<html>
<head><title>Delete Cookie</title><head>
<script type = "text/javascript">
var i = 0;
1
function delCookie (cookieName) {
2
document.cookie = cookieName + "="
+"; expires=Thu, 01-Jan-1970 00:00:01 GMT";
alert("Cookie was deleted!");
seeCookie();
}
 
 
Search WWH ::




Custom Search