Skip to content

Instantly share code, notes, and snippets.

@christian-bromann
Created September 3, 2012 20:48
Show Gist options
  • Save christian-bromann/3613348 to your computer and use it in GitHub Desktop.
Save christian-bromann/3613348 to your computer and use it in GitHub Desktop.
[Chrome Extension] Remove all cookie data
function extrapolateUrlFromCookie(cookie) {
var prefix = cookie.secure ? "https://" : "http://";
if (cookie.domain.charAt(0) == ".")
prefix += "www";
return prefix + cookie.domain + cookie.path;
}
chrome.cookies.getAll({}, function(cookies) {
for(var i=0; i<cookies.length;i++) {
chrome.cookies.remove({url: extrapolateUrlFromCookie(cookies[i]), name: cookies[i].name});
}
});
{
"manifest_version": 2,
"name": "MyExtension",
"version": "0.1",
"description": "My awesome chrome extension!",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "index.html"
},
"background": {
"page": "background.html"
},
"permissions": ["tabs", "cookies", "*://*/"],
"content_scripts": [{
"js": ["js/contentscript.js"],
"matches": ["<all_urls>"]
}],
"content_security_policy": "script-src 'self' http://localhost; object-src 'self'"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment