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

210
Views
Javascript - code injected multiple times on specific website

I would like to know why and how to fix:

My code is being injected a few times while being o specific website, can't find why.

It should be injected only when visiting a specific url (it can be different for example tickets/*****).

manifest.json

{
"manifest_version": 2,
"name": "ext",
"version": "1.619",
"description": "Does things:)",

"background": {
    "scripts": ["background.js"]
},

"content_scripts": [
    {
        "matches": ["https://www.example.com/agent/tickets/*"],
        "js": ["foreground.js"]
    }
],

"permissions": [
    "tabs",
    "activeTab",
    "http://*/",
    "https://*/"
]
}

background.js

chrome.tabs.onUpdated.addListener(function(id, info, tab){
    /*if (tab.status !== "complete"){
        return;
    }*/
    if(tab.url.indexOf("tickets") != -1){
       console.log("injected");
       chrome.tabs.executeScript(tab.id, {"file": "foreground.js"});
    }
});
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!