I need a way to process HTML before it's actually loaded and parsed by Mozilla. Is there any content listener that I can use in my Firefox extension?
A:
Do you mean something like greasemonkey? Sorry, I don't know enough about Firefox extensions. The Greasemonkey website is blocked here in China and my VPN does not work at the moment, but maybe they are open source. Then you can see what they do, if writing a greasemonkey skript is not what you want.
erikb
2010-09-27 12:26:05
Greasmonkey starts processing DOM model after "DOMContentLoaded" event is triggered. What I need is to intercept HTML content **before** Mozilla loads and parses it. But you're right, I need something similar to this extension, with the exception that it works at earlier stage.
spektom
2010-09-27 13:03:04
A:
Add an Event Listener to the gBrowser global object, making sure to set usecapture to true. You could also intercept the response.
Fábio
2010-09-27 16:20:01
The Http Channel also implements other interfaces, such as nsIRequest, which might do what you want. This took me a long time to realize.
MatrixFrog
2010-09-28 03:39:33