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

216
Visualizações
Chrome extension doesn't work if I upload a local content script

I have a Google Chrome extension that I load from my computer. The extension folder contains 2 files, manifest.json and content.js like this:

{
  "name": "My extension",
  "version": "0.0",
  "description": "My first extension",
  "manifest_version": 2,
  "content_scripts": [
    {
      "matches": [
        "https://my_new_website.com/*"
      ],
      "js": [
        "./content.js"
      ],
      "run_at": "document_idle",
      "all_frames": true
    }
  ]
}

and

const script = document.createElement('script');
script.setAttribute('type', 'text/javascript');
script.setAttribute('src', 'https://my_website/content_file.js');
document.head.appendChild(script);

Now, I want to upload the content_file.js from my computer instead of https://my_website/. So, I replaced the following line:

script.setAttribute('src', 'https://my_website/content_file.js');

with

let image = require("path_to/content_file.js");
script.setAttribute('src', image);

But my Chrome extension didn't work the same as the first case. What am I doing wrong? Isn't the image command sending the same information as the online src file? Thank you.

about 4 years ago · Juan Pablo Isaza
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