Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

215
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda