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

133
Views
Tab in undefined when Chrome Extension console is opened and focused

I have this function :

async getCurrentTab() {
    let queryOptions = { active: true, currentWindow: true };
    let [tab] = await chrome.tabs.query(queryOptions);
    console.log("current tab: " + tab);
    return tab;
}

which is triggered this way :

chrome.tabs.onUpdated.addListener(changePageHandler);
    async function changePageHandler(tabId, changeInfo) {
        if (changeInfo.status == 'complete') {
            getCurrentTab();
        }
    }

My problem is that when i focus the Chrome Console window (click or just CMD+TAB to it) and then refresh the web page i get this :

current tab: undefined

But if I click on the webpage and refresh or just close the Chrome Console window i get this :

current tab: [object Object]

Which means (I think) that it has been recognized, can somebody explain to me what is going on please ?

Thanks !

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!