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

185
Views
¿Hay alguna manera de que una extensión de Chrome escuche siempre?

Creé una extensión de Chrome que realiza un seguimiento de los sitios visitados al obtener sus URL. El problema es que solo recibe la URL de la página cuando se abre/hace clic en la extensión. ¿Cómo puedo hacer que "escuche" los sitios que visito en todo momento?

Traté de solucionarlo haciendo que obtenga la URL en el sitio onload, pero creo que lo que sucede es que escucha en la EXTENSION onload:

 window.onload = function () { chrome.tabs.getSelected(null, function (tab) { d = document; f = document.getElementById("history"); var i = d.createElement('li'); i.innerHTML = tab.url; f.appendChild(i); d.body.appendChild(f); localStorage.setItem("pastVisits", f.innerHTML); }); try { // trycatch because what if there's no history to pull? document.getElementById("history").innerHTML += localStorage.getItem("pastVisits"); } catch (error) { // do nothing... } }
 body { width: 800px; height: 600px; background-color: rgb(155, 155, 155); color: white; font-family: 'Courier New', Courier, monospace; }
 <!DOCTYPE html> <html> <head> <title>User Locations</title> <script src="popup.js"></script> <link rel="stylesheet" href="style.css"> </head> <body> <p id="history"> </p> </body> </html>

Se agregó el fragmento a pesar de que no funciona en el fragmento por algún motivo (aunque sí funciona en la extensión). Aquí hay una imagen de ello: ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Agregará el permiso "historial" .

 // manifest.json { "name": "My extension", ... "permissions": [ "history" ], ... }

Y luego, usa

 // background.js chrome.history.onVisited.addListener( result => console.log(result) )

"Se activa cuando se visita una URL, proporcionando los datos de HistoryItem para esa URL. Este evento se activa antes de que se cargue la página".

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