This is my code:
chrome.tabs.create({ "url": from_url}, function(newTab){
console.log("tab id:" + newTab.id);
console.log("url: " + from_url);
console.log("tab url:" + newTab.url);
console.log("Executing scrape script");
chrome.scripting.executeScript({
target: {tabId: newTab.id},
function: scrape
});
});
this is my output:
tab id:217
url: https://developer.chrome.com/docs/extensions/mv3/getstarted
tab url:
Executing scrape script
Uncaught (in promise) Error: Cannot access contents of url "". Extension manifest must request permission to access this host.
For some reason when I try to execute a script for the just created tab, it doesn't find any url associated with the tab.You may notice in the error message that the url is an empty string. As you can see in the output log tab url returns nothing. Also I have already set host_permissions in my manifest file to <all_urls>