--- === background.html === ---
/*
* Handles data sent via chrome.extension.sendRequest().
* @param request Object Data sent in the request.
* @param sender Object Origin of the request.
* @param callbackFunction Function The method to call when the request completes.
*/
function onRequest(request, sender, callbackFunction) {
//your actions here
};
/*
* Add request listener
*/
chrome.extension.onRequest.addListener(onRequest);
--- === contentScript.js === ---
function callbackFunction(response) {
//process the response
}
chrome.extension.sendRequest({'action': 'your action'}, callbackFunction);
вам также необходимо определить скрипт содержимого в файле манифеста