Using the IWebBrowser2 interface is fairly easy to know when navigation took place (OnBeforeNavigate) and finished (OnDocumentComplete). However, a lot of work in browsers are done through Ajax calls (which use XMLHttpRequest).
Is there a way to subscribe to events tracking when an Ajax call occurred and finished in IE?
The official way is to create a changelog using an IHTMLChangeSink. It's not complicated, but it's a bit tedious to implement so that you don't lose any requests.
I think the best way to do this may be to create an HTTP proxy server, then use InternetSetOption to set the proxy (note that the first argument is NULL
to set for the current process) to your local HTTP proxy server.
This previous question seems to provide an answer:
Monitor ajax calls from IE BHO
It basically says you have to inject some JavaScript to every page to handle onreadystatechange.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With