Using PHP
To remove a cookie in php we can use setcookie function unset($_COOKIE['amazon']); setcookie('amazon', null, -1, '/');
where amazon is the name of the cookie.
- Second parameter must be set to blank or null
- Third parameter is expire date which should be set to a old or negative value.
- Fourth parameter is the path of the cookie.
Using Jquery
Use the library from
https://github.com/carhartl/jquery-cookie
To create a cookie which expires in 100 days
$.cookie('name', 'value', { expires: 100 });
To read a value
$.cookie('name');
To delete cookie
$.removeCookie('name');
NOTE: We cannot delete cookie of a different domain using any php or jquery. It is not allowed due to security issues.
Related Posts
Facebook Debugger – Bad Response Code: URL returned a bad HTTP response code : 404
I faced a issue with one of my clients sites after migration. The facebook debugger…
Jetpack not connecting 404 error
Check the url www.domain.com/xmlrpc.php and you should receive only “XML-RPC server accepts POST requests only.”…
Moneybird API Oauth Issue – Token Request
The example code in the moneybird API for oauth doesn’t give a clear picture of…
Bigcommerce WEBDAV tool
I had the opportunity to work in bigcommerce for one of the clients and i…