Monitor ajax calls from IE BHO

I’m trying to find a way to detect changes on a page from a BHO. For the Firefox version of the plugin I’m using DomNodeInserted, but this isn’t available in IE. I’ve also looked at using onpropertychange, but this only allows you to monitor a single element (not children).

I’m now wondering if it’s possible to monitor when AJAX requests are called. If so, I can make the changes to the page after the AJAX request has completed. Only problem is, I can’t find a way to do it.

Here’s my attempt so far, based on jeffamaphone’s suggestions, it doesn’t work but maybe it’ll jog someone’s memory.

    public class ChangeMonitor : IHTMLChangeSink {
        public void Notify()

    void registerMonitor()
        HTMLDocument document = _webBrowser2.Document;

        ChangeMonitor monitor = new ChangeMonitor();
        IHTMLChangeSink changeSink = monitor;
        IHTMLChangeLog changeLog = null;

        ((IMarkupContainer2)document).CreateChangeLog(changeSink, out changeLog, 1, 1);


For IE, onreadystatechange will work as an equivalent to DomNodeInserted. A DHTML behavior must be attached to the element via htc, but the htc file does not have to exist:

document.documentElement.attachEvent("onreadystatechange", Notify);

The BHO can inject the script to handle the event.