Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

553
Visualizações
Fetch inside content script fails with chrome-extension://invalid

Inside my content script, I resolve a URL and execute a fetch on it:

let url = chrome.runtime.getURL('/hints/heart.html')

console.log("url = " + url)

fetch(url)
    .then(r => r.text())
    .then(injectedContent => {
        // do stuff with injectedContent
    });

The URL is resolved correctly. I can see that from printing it to the console. The file there also exists.

However, fetch is returning an error saying that it's trying to call the URL chrome-extension://invalid.

I already added the path the web_accessible_resource in the manifest:

"web_accessible_resources": [
    {
      "resources": [ "/hints/*" ],
      "matches": [ "https://*.myurl.com/*" ]
    }
  ]

What am I missing?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Always reload your extension from chrome://extensions/ when you modify files like background.js or the manifest.json.

You can use the normal page refresh when you only modify html files and the js files linked to them (popup.html and popup.js for example).

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda