Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

211
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!