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

93
Views
Cómo hacer que una extensión de Chrome funcione inmediatamente en una página nueva

Estoy tratando de hacer que mi extensión actúe inmediatamente en una nueva página en lugar de cuando hago clic en un botón. Por ejemplo, este código funciona en términos de cambiar las words en la página, pero solo una vez que hago clic en un botón de mi ventana emergente predeterminada. ¿Cómo puedo llegar a donde actúa inmediatamente una vez que un usuario cambia de página? Intenté crear un nuevo archivo .js pero no hizo nada.

 function change(){
 const text = document.querySelectorAll("h1, h2, h3, h4, h5, p, li, td, caption, span, a")
for(let i=0;i<text.length;i++){
 if(text[i].innerHTML.includes("The")){
 text[i].innerHTML = text[i].innerHTML.replace("The","A")
 }
 
}
}
change();
almost 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Utilice content_scripts.

manifiesto.json

 {
 "name": "hoge",
 "version": "1.0",
 "manifest_version": 3,
 "content_scripts": [
 {
 "matches": [
 "<all_urls>"
 ],
 "js": [
 "matches.js"
 ]
 }
 ]
}

partidos.js

 function change(){
 const text = document.querySelectorAll("h1, h2, h3, h4, h5, p, li, td, caption, span, a")
for(let i=0;i<text.length;i++){
 if(text[i].innerHTML.includes("The")){
 text[i].innerHTML = text[i].innerHTML.replace("The","A")
 }
 
}
}
change();
almost 4 years ago · Santiago Trujillo Report
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!