There are three options for running content scripts:
document_start- injected at the start of the<head>document_end- injected right afterDOMContentLoadeddocument_idle- injected when???
There are three options for running content scripts:
document_start - injected at the start of the <head>document_end - injected right after DOMContentLoadeddocument_idle - injected when???According to the current Chromium source:
We try to run idle in two places: here and DidFinishLoad. DidFinishDocumentLoad() corresponds to completing the document's load, whereas DidFinishLoad corresponds to completing the document and all subresources' load. We don't want to hold up script injection for a particularly slow subresource, so we set a delayed task from here - but if we finish everything before that point (i.e., DidFinishLoad() is triggered), then there's no reason to keep waiting.
Translated into web developer speak that basically means…
document_idle scripts will run the earliest one of these things is true:
window.onload has firedDOMContentLoaded has fired.On typical pages, these scripts will likely run at #2.