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

104
Visualizações
Load event not being triggered in Firefox?

I'm working on a browser extension, and I need specific code to run when the new window is loaded. The below code works perfectly in Chrome/Edge:

window.addEventListener('load', (event) => {
  handle_data();
});

This event is never triggered in the Firefox version. Alternatively, I tried:

window.onload = handle_data;

But this is called before the DOM of the page is loaded. Any idea why this is an issue in Firefox?

EDIT: The script is executed using the following:

function open_tab() {
  chrome.tabs.create({
    url: "https://www.test.ca/apd/myad",
    active: false
  }, function (tab) {
    chrome.tabs.executeScript(tab.id, { file: "manage_content_script.js" });
  });
}

And is called on the click of the extension, using the following code in background.js:

if (msg.content == "clicked") {
      chrome.tabs.executeScript(null, { file: "dom_script.js" });
      open_tab();
    }

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Have you tried DOMContentLoaded?

window.addEventListener('DOMContentLoaded', (event) => {
    console.log('DOM fully loaded and parsed');
});

See: https://developer.mozilla.org/en-US/docs/Web/API/Window/DOMContentLoaded_event

about 4 years ago · Juan Pablo Isaza Relatório
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