I’m a beginner in Chrome extensions and I’m just trying to make a simple extension which take a screenshot every 5 minutes.
The problem is I got the error “message: “Either the ‘<all_urls>’ or ‘activeTab’ permission is required.”
Here is my manifest and my background.js :
{
"manifest_version": 3,
"name": "Screen Capture Every 5 Seconds",
"version": "1.0",
"description": "Take a screenshot every 5 seconds",
"permissions": [
"activeTab",
"storage",
"scripting"
],
"background": {
"service_worker": "background.js"
},
"action": {
"default_popup": "popup.html"
},
}
function takeScreenshot() {
chrome.tabs.captureVisibleTab(null, {}, function(image) {
if (chrome.runtime.lastError) {
console.error(chrome.runtime.lastError);
} else {
console.log("Screenshot taken:", image);
}
});
}
chrome.runtime.onInstalled.addListener(() => {
console.log("Extension installed");
setInterval(takeScreenshot, 5000);
});
Ty for your help !
I tried to read some topics on forums but it didn’t help me