My plan was to make an ajax without sending the cookies there. I tried to do some magic via jquery, but unfortunately I found I have no power over what cookies are sent. So I needed to delete them, do the ajax and then put them back. Here's the code.
chrome.cookies.getAll({domain: domain}, function(cookies) {
var domain = 'facebook.com';
// 1. delete cookies
var myCookies = _.cloneDeep(cookies);
for(var i=0; i<cookies.length;i++) {
chrome.cookies.remove({url: "https://"+domain + cookies[i].path, name: cookies[i].name});
}
// 2. now do some ajax
// 3. now get them back
for (var i = 0; i < myCookies.length; ++i) {
var cookie = myCookies[i];
var obj = {
name: cookie.name,
value: cookie.value,
url: "https://"+domain + cookie.path
};
chrome.cookies.set(obj);
}
});
unfortunately, it logs me out, even when the cookies are added back, like they were supposed to. where is the catch? Is the "url" and "domain" argument used well?