I dont get enaugh mechanism of interaction component in Google Chrome Extensions. I need to store data after click on any page and save this in storage.
As I know, it should be content script that works with content page and which send event to background script to save data.
I tried this code in content.js
:
window.onLoad = function() {
alert("s");
document.addEventListener("click", function (e) {
alert("d");
chrome.storage.sync.set({'key' : "Oleg"}, function (){
alert("Ok");
});
chrome.storage.sync.get('key', callback(data));
});
}
But this is silent