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

152
Visualizações
Force Chrome to always load tabs

For some reason, Chrome doesn't load background tabs until Activated, selected, or both. I am writing a script with Manifest v3 to allow tabs to load when opened in the background that will Activate them and return to the original tab so they load. Currently, it is not working. Are there better workarounds than having a background process always running and sending a message to activate these tabs and return to current tab?

chrome.tabs.onCreated.addListener(newTab => newTabCreated(newTab));

async function newTabCreated(newTab) {
  try {
    const currentTab = await getCurrentTab();

    await chrome.tabs.update(newTab.id, { active: true });
    await chrome.tabs.update(currentTab.id, { active: true });

    const loadedStatus = await chrome.tabs.query({status: "complete"});

    loadedStatus.forEach(element => {
      JSON.stringify(console.log(element));
    });

    console.log(`
      current tab id: ` + JSON.stringify(currentTab.id) + `
      new tab id: `+ JSON.stringify(newTab.id));

  } catch (error) {
    console.log("Error: " + error);
  }
}

async function getCurrentTab() {
  let queryOptions = { active: true, currentWindow: true };
  const [tab] = await chrome.tabs.query(queryOptions);
  return tab;
}
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