Reputation: 323
Google Chrome does not sync all content settings, specifically Cookie rules. Meanwhile JavaScript settings sync fine.
I'm trying to query the list of all cookie blocking domains so I can sync them using my own storage through an extension. Wildcard patterns only work if TLD is specified.
chrome.contentSettings.cookies.get({
primaryUrl: 'https://example.com' //---Not working '<all_urls>' or 'https://*/*"'
}, function (details) {
console.log(details)
});
Could I possibly query chrome://settings/content/cookies as a web page directly from an extension? Any other ideas?
Documentation for Chrome content settings seems to support '<all_urls>'
but it only works on 'set' not 'get'.
Upvotes: 3
Views: 3031
Reputation: 56
You need to specify the primaryUrl with a value like http://*
or https://*
or http://somesite.com/
etc., and you then get the details.setting
Also note the delay I use before accessing the info at the end of the function below.
function GetContentSettings(){
var S='';
chrome.contentSettings.cookies.get({primaryUrl:'http://*'},function(details){S+='Cookies : '+details.setting+'<br>';});
chrome.contentSettings.images.get({primaryUrl:'http://*'},function(details){S+='Images : '+details.setting+'<br>';});
chrome.contentSettings.javascript.get({primaryUrl:'http://*'},function(details){S+='JavaScript : '+details.setting+'<br>';});
chrome.contentSettings.location.get({primaryUrl:'http://*'},function(details){S+='Location : '+details.setting+'<br>';});
chrome.contentSettings.plugins.get({primaryUrl:'http://*'},function(details){S+='Plugins : '+details.setting+'<br>';});
chrome.contentSettings.popups.get({primaryUrl:'http://*'},function(details){S+='Popups : '+details.setting+'<br>';});
chrome.contentSettings.notifications.get({primaryUrl:'http://*'},function(details){S+='Notifications : '+details.setting+'<br>';});
// chrome.contentSettings.fullscreen.get({primaryUrl:'http://*'},function(details){S+='Full Screen : '+details.setting+'<br>';});
// chrome.contentSettings.mouselock.get({primaryUrl:'http://*'},function(details){S+='Mouse Lock : '+details.setting+'<br>';});
chrome.contentSettings.microphone.get({primaryUrl:'http://*'},function(details){S+='Microphone : '+details.setting+'<br>';});
chrome.contentSettings.camera.get({primaryUrl:'http://*'},function(details){S+='Camera : '+details.setting+'<br>';});
chrome.contentSettings.unsandboxedPlugins.get({primaryUrl:'http://*'},function(details){S+='Unsandboxed Plugins : '+details.setting+'<br>';});
chrome.contentSettings.automaticDownloads.get({primaryUrl:'http://*'},function(details){S+='Automatic Downloads : '+details.setting+'<br>';});
setTimeout(function(){alert('Content Settings...<br><br>'+S);},1500);
}
NB: I've commented out the two troublesome ones.
Upvotes: 4