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

106
Views
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
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!