manifest,json
{
"background": {
"scripts": ["jquery-3.2.1.min.js", "background.js"]
},
"content_scripts": [{
"all_frames": true,
"run_at": "document_start",
"matches": [
"http://*/*",
"https://*/*",
"file:///*"
],
"css": ["mystyles.css"],
"js": ["jquery-3.2.1.min.js", "myscript.js"]
}],
"permissions": [
"<all_urls>",
"contextMenus",
"storage",
"clipboardWrite",
"clipboardRead",
"activeTab",
"identity",
"webRequest",
"webRequestBlocking"
],
"web_accessible_resources": [
"*.png"
]}
content script
chrome.runtime.onMessage(function(message, sender, sendResponse){
console.log(message);});
chrome console
my chrome version : 58.0.3029.110 (64-bit) why chrome.runtime.onMessage is undefined in content_script? Please tell me how to solve this problem~:)
Whether there are other ways to achieve that background sendMessage to content script?