Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

230
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda