I wrote a simpler chrome extension, that opens a tab when the extension icon is clicked as follows
manifest.json
{
"name": "Express",
"description": "Express code name",
"version": "1.1",
"manifest_version": 3,
"background": {
"service_worker": "background.js"
},
"permissions": ["storage", "activeTab","scripting","tabs"],
"host_permissions":["http://*/*", "https://*/*"],
"action": {
"default_title": "Express"
}
}
background.js
chrome.action.onClicked.addListener(async function (e) {
var tab = await chrome.tabs.create({
url: "https://www.google.com/",
});
chrome.scripting.executeScript({
target: { tabId: tab.id },
files:['content.js']
});
});
content.js
console.log('hello world');
but when I click on the extension icon, it shows this error message in the console
Uncaught (in promise) Error: Cannot access contents of url "". Extension manifest must request permission to access this host.
What I am doing wrong in it?