I'm developing a BHO
and need to process page content on OnDocumentComplete
event.
But I found a problem - there are no page content at that moment, because it is generated later by JavaScript
.
I was trying to call myself by using Navigate method with JavaScript function that must call me, but without any success. I've searched by keywords bho, internet-explorer, javascript and found no useful results.
Thanks for any advices.
EDIT1:
Creating a new thread and passing into it pointer to this
works fine in development environment, but cause crashes on real system.
EDIT2:
Today's workaround - IE tool-bar button IOleCommandTarget::Exec
method calls page parsing code. But it requires user interaction.
EDIT3:
New workaround - in FinalConstruct
I create my own window. If template search fails I create new thread, that sleeps some seconds and sends WM_USER
message to that window. Window procedure calls page parser.
Just to close the issue. Today's solution is to handle most of event that can be fired by IE:
Inside of my code I check against the URL witch type of event may occur for the current page and do parsing inside this event handler.