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

99
Visualizações
Clear whole DOM before page load from browser extension

I am trying to write a browser extension which improves a website with very bad performance and countless unnecessary and duplicate network requests by replacing the content with a simpler version and doing the requests myself.

To do this I would like to replace/clear the whole DOM before the content is loaded and network requests are sent. So far I have tried multiple ways, but all of them only work when the content-script is set to "run_at": "document_end". This way I can do something like

document.head.innerHTML = "";
document.body.innerHTML = "";

Because it only runs at document_end, it takes some seconds before the script is run and there are still some network requests going out.

Is there any way to completely clear the DOM when loading a website, so that it my script can be run immediatly? When I try my scripts with "run_at": "document_start they don't work at all and the original page is loaded.

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