I want to delete all cookie on certain domain automatically so I have crafted an extension.I am able to view the cookies for the domain but I didn't find any method to delete them
Here is my code the function eraseCookie is just called one time
Any suggestions ?
function eraseCookie(name) {
document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
}
$(document).ready(function() {
var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++)
{
window.alert(cookies[i]);
eraseCookie(cookies[i].split("=")[0]);
}
});
I am also using jquery but I don't see a problem in that!
{
"name": "Gapa",
"version": "0.1",
"description": "",
"browser_action": {
"default_icon": "sigla.png",
"default_title": "",
"popup": "hello.html"
},
"content_scripts": [
{
"matches": ["*://*.google.ro/*"],
"js": ["jquery-1.8.2.min.js","cookie_handler.js"]
}
],
"icons": {
"128":"sigla.png" },
"permissions": [
"cookies",
"tabs",
"*://*.google.ro/*"
],
"manifest_version": 2
}
LE : Here is how my script file looks now:
$(document).ready(function() {
var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++)
{
chrome.cookies.remove({"url": ".google.ro", "name":cookies[i].split("=")[0]}, function(deleted_cookie) { window.alert('deleted cookie') });
}
});