Basically, after making some changes to my website, the cookies my users have stored break it. Obviously, I can't go one by one and have the users delete them, so how can I force it from the website? The difference for my issue, is that I want to delete all of the cookies.
Asked
Active
Viewed 1,130 times
1
-
Please show your code. – Razia sultana Nov 07 '17 at 03:28
1 Answers
0
In this cases that we set cookie in the client side, we can set a code in the first lines of our application and remove that coockie like this:
In JavaScript:
document.cookie = NAME + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';
Or in PHP:
if (isset($_COOKIE['NAME'])) {
unset($_COOKIE['NAME']);
setcookie('NAME', null, -1, '/');
}
With this approach all users that visit your website again its cookie expires.
You can delete all cookies in PHP. please follow how to delete all cookies of my website in php also for JavaScript How can I delete all cookies with JavaScript?

Majid Abbasi
- 1,531
- 3
- 12
- 22
-
-
You can delete all cookies i edited my answer, and also one if you know its name – Majid Abbasi Nov 07 '17 at 18:44