জাভাস্ক্রিপ্ট দিয়ে সকল কুকি ক্লিয়ার করতে, এক্সপায়ারি ডেটকে অতীতে একটি টাইম সেট করুন।
উদাহরণ
সকল কুকি ক্লিয়ার করার জন্য নিচের কোডটি রান করার চেষ্টা করুন -
<html>
<head>
<script>
<!--
function WriteCookie() {
var now = new Date();
now.setMonth( now.getMonth() - 1 );
cookievalue = escape(document.myform.customer.value) + ";"
document.cookie="name=" + cookievalue;
document.cookie = "expires=" + now.toUTCString() + ";";
document.write("Setting Cookies : " + "name=" + cookievalue );
}
//-->
</script>
</head>
<body>
<form name="myform" action="">
Enter name: <input type="text" name="customer"/>
<input type="button" value="Set Cookie" onclick="WriteCookie()"/>
</form>
</body>
</html>