0

I'm currently creating a quite easy chrome extension which open a new window with a simple URL, and inject JS in this new window.

But I have this issue : "Uncaught (in promise) Error: Cannot access contents of url "". Extension manifest must request permission to access this host."

I'm pretty sure of my code and my manifest, and I really can't find any solution.

My code:

chrome.windows.create({url: "http://www.google.fr", type: "popup", width: 1240, height: 768, focused: true}, tab => {
      chrome.scripting.executeScript({
         target: { tabId: tab.tabs[0].id },
         function: test,
      });
})

 function test(){
    alert('it's working');
  }

My manifest:

{
    "name": "COSMO Heatmap",
    "description": "Description à faire",
    "version": "1.0",
    "manifest_version": 3,
    "background": {
        "service_worker": "background.js"
    },
    "content_security_policy": {
        "extension_pages": "script-src 'self'; script-src-elem 'self' 'unsafe-inline' https://ajax.googleapis.com; object-src 'self'"
    },
    "permissions": ["storage", "activeTab", "scripting", "unlimitedStorage", "tabs","webRequest", "<all_urls>"],
    "host_permissions": ["<all_urls>"],
    "optional_permissions": ["<all_urls>"],
    "action": {
        "default_popup": "popup.html",
        "default_icon": {
            "16": "/images/CosmoLogo.png"
          }
      },
      "icons": {
        "16": "/images/CosmoLogo.png",
        "32": "/images/CosmoLogo.png",
        "48": "/images/CosmoLogo.png",
        "128": "/images/CosmoLogo.png"
      }
  }

0 Answers0