i know this question has been asked before but i dont know hwo to make it work.
this is the content script:
console.log("online");
chrome.extension.sendRequest({foo: "yes"}, function(response) {
console.log(response.thefoo);
});
and this is the background page:
chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
if (request.foo == "yes")
sendResponse({thefoo:"this is the foo"});
else
sendResponse({"it didnt work"});
});
the code that i have here, its from one of the answered questions around here with a few changes that i made, but it didnt work even when i put it exactly. you can see that answer here Chrome extension: accessing localStorage in content script