I try to update Manifest Version from 2 to 3. And chrome.tabs.captureVisibleTab throw error
Unchecked runtime.lastError: Either the '<all_urls>' or 'activeTab' permission is required.
As '<all_urls>' is not available in Manifest 3, I declared the 'activeTab' permission. But it doesn't work.
As My code in Background.ts
export const getCapture = (): Promise<string> => {
return new Promise((resolve) => {
chrome.tabs.captureVisibleTab((dataUrl) => resolve(dataUrl));
});
};
Manifest.json
{
...,
"permissions": [
"contextMenus",
"tabs",
"activeTab"
],
}
So how can I use this api to take a screenshot in Manifest 3? Or should I use another api?