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

223
Vistas
How can I detect when the active tab is changed and record it?

I am building a chrome extension and would like to detect when the active tab is changed and record it in a firestore database. I have written and debugged the code. It doesn't show any error, but it doesn't update either. It just does nothing. I have also tried this with onActivated instead of onUpdated but it still doesn't do anything. Here is my javascript code:

const firebaseConfig = {
apiKey: "xxxxxxx-I8oUvn4jR3foTWrZWSpmWMbikPtJjeg",
authDomain: "webxxxxr-xxxxx.firebaseapp.com",
projectId: "webxxxxr-xxxxx",
storageBucket: "webxxxxr-xxxxx.appspot.com",
messagingSenderId: "xxxxxxx85181",
appId: "x:xxxxxxx85181:x:xxxxxxxdbeaed13e83e274"


 };
  
  // Initialize Firebase
  const app = firebase.initializeApp(firebaseConfig);
  const db = app.firestore();
  
var idTag = "lcoddjhmpnblmfbbkbdgeamnpbclekof";
chrome.runtime.sendMessage(idTag, {getTargetData:true},
    function(response) {
        var id = response.targetData;
        db.collection('browsers').doc(id).onSnapshot((doc) => {
            if (doc.exists) {
                chrome.tabs.onUpdated.addListener(handleActivated());
                function handleActivated(activeInfo) {
                chrome.tabs.getSelected(null, function(tab) {
                    db.collection('browsers').doc(id).update({
                        'tab': tab.url,
                    });
    
                })
            }
            } else {
            }
        })
    }
    );
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