Reputation: 551
Context: I'm making a program that extracts the main content from a webpage. However, currently what I am doing is waiting for the entire webpage to load and render (which can take a long time, especially for pages with a lot of scripts).
What I want is to just get the html of the page right when the page starts loading so I can extract the main content without having to wait for the entire webpage to render and load.
run_at: "document_start"
in the mainfest.json file does not work because it is run before the html even appears.
Upvotes: 3
Views: 1539
Reputation: 73776
Use run_at: "document_start"
with DOMContentLoaded event listener (or MutationObserver if you want to process the document while it's loading) in your content script.
Upvotes: 5
Reputation: 77551
You should try "document_end"
, it should run earlier than the default "document_idle"
.
Upvotes: 0