In my Firefox extension I am using DOMContentLoaded
to detect page load and insert my HTML. Is there an event which triggers before this and still the document is available at that time?
Note: This answer refers to XUL-based extensions. As of Firefox 57, this technology is obsolete. The functionality mentioned here is no longer available to extensions.
There is content-document-global-created
notification that is sent out when a document is created, before any content is added to it (to be precise, it happens when the browser receives the HTTP headers of the response and knows that it isn't a redirect or such). That's the earliest point where you can get the document. The DOMContentLoaded
event is fired once Gecko finishes downloading the contents of the document, that's the earlies point where you can access the complete DOM. In between there is a bunch of other events, e.g. lots of progress listener events - which one you use depends on what you are trying to do, there is no general answer.
event.target.top == event.target
? –
Etheridge subject.parent.length == 0
. That works. But body is not available when this notification is sent. Is there any solution for this. I tried using a clock which will check for availability for body once in every 10ms after this notification is received. But it doesn't seem to work. Is there any solution for this? –
Crackup document.documentElement.appendChild()
? –
Etheridge © 2022 - 2024 — McMap. All rights reserved.