I'm trying to develop a chrome extension, My manifest.json is :
{
"name" : "Extension",
"version" : "2.2",
"description" : "Web collaboration chrome extension",
"permissions": ["tabs", "activeTab"],
"browser_action": {
"default_icon": "logo.png"
},
"icons": {
"128": "icon128.png"
},
"content_scripts": [{
"matches": ["*://*/*"],
"run_at": "document_idle",
"match_about_blank": true,
"all_frames": true,
"js": ["content.js", "addon.js"]
}],
"background": {
"scripts": ["background.js"],
"persistent": false
},
"content_security_policy": "script-src 'self' https://expample.com/umd/example.min.js; object-src 'self'",
"manifest_version": 2
}
background.js is :
chrome.tabs.query({active: true, currentWindow: true}, function (tabs) {
let activeTab = tabs[0];
chrome.tabs.sendMessage(activeTab.id, {"message": "request", "payload": preferences}, function(response) {
if (!chrome.runtime.lastError) {
console.log('response', response);
}else{
console.log(chrome.runtime.lastError);
}
});
});
content.js is:
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
if(request.message === "request") console.log('response received', request.payload)
sendResponse({status: "done"});
return true;
}
)
Chrome Inspector is giving error: chrome.runtime.lastError {message: 'Could not establish connection. Receiving end does not exist.'}.
Need help