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

222
Views
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
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!