Reputation: 63
I am using following code to delete a cookie:
document.cookie = "CookieName=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
There are two cookies, one in on domain www.websiteaddress.com
and other is on .websiteaddress.com
.
When I am on page www.websiteaddress.com
the cookie having domain address www.websiteaddress.com
gets deleted but other one is not deleted. How can I delete both cookies while loading javascript on www.websiteaddress.com
Upvotes: 6
Views: 245
Reputation: 39956
You are not allowed to delete cookies on another site. Because there is no guarantee that you own both www.websiteaddress.com
and .websiteaddress.com
. You can only delete cookies that you set for the current domain.
Upvotes: 5