I would like to make a Google Chrome extension that allows you to manage cookies:
For example in Facebook when you log in, this extension would say "Do you want to save the cookie? Yes / No"
I use JavaScript, I have the following code in it but it doesn't work for me.
if(!document.__defineGetter__) {
Object.defineProperty(document, 'cookie', {
get: function(){return ''},
set: function(){return true},
});
} else {
document.__defineGetter__("cookie", function() { return '';} );
document.__defineSetter__("cookie", function() {} );
}
Can someone help me which way can I check If cookie going to save and disable it if user select "don't save cookie" option?
You should look into the chrome.cookies
API.
Specifically, you can hook up to chrome.cookies.onChanged
event and react accordingly to every cookie added.
There is also an API to simply disable cookies, possibly per domain: chrome.contentSettings
API.
The usual applies: if you're new to Chrome extensions, read through the Overview. Also see the Samples page.