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

135
Visualizações
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
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