Answer the question
In order to leave comments, you need to log in
Chrome extension how to delete the right cookie?
Good day!
I'm writing extensions for chrome, I want to delete an HTTP cookie on a certain site after it is loaded
"permissions": [
"storage",
"cookies",
"tabs",
" http://*/* ",
" https://*/ * "
]
"background": {
"scripts": ["background.js"]
}
Permissions and background connected, what to do next?
I tried through https://developer.chrome.com/extensions/cookies , but it didn't work for me
Who will help out? I will be grateful!
chrome.tabs.onActivated.addListener(function(activeInfo) {
chrome.tabs.get(activeInfo.tabId, function(Tab) {
if (Tab.url.indexOf("https://www.site.ru/") != -1){
chrome.cookies.getAll({domain: "www.site.ru"}, function(cookies) {
for(var i=0; i<cookies.length;i++) {
alert(cookies[i].name);
if (cookies[i].name == "city")
chrome.cookies.remove({url: "www.site.ru" + cookies[i].path, name: cookies[i].name});
}
});
}
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question