Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript Not deleting all cookies

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

like image 481
Quitso Avatar asked Jun 14 '15 14:06

Quitso


1 Answers

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.

like image 155
Salah Akbari Avatar answered Oct 09 '22 16:10

Salah Akbari