Click here to Skip to main content
11,920,772 members (57,095 online)
Rate this:
Please Sign up or sign in to vote.
See more: C++ C Extension IE9 BHO
Hello everyone. I am currently building a BHO which aims at modifying the page DOM after the page is loaded. The DOM modification is performed within the DISPID_DOCUMENTCOMPLETE handler. However, some SCRIPTS run after the DISPID_DOCUMENTCOMPLETE event is triggered which modify the structure of the page.

Is there a way for me to modify the DOM AFTER everything has been loaded and run including the SCRIPTS?

I've tried a number of events but, they all behave the same way:

Thanks in advance!
Posted 31-May-13 1:43am
Not clear why? And, if all scripts are already complete, what do you call that is executed after it? :-)
Daroosh 31-May-13 9:43am
I didn't really get what don't you understand. Anyway, the scripts are part of the page, not my extension, these scripts modify the page structure (Add a few elements that didn't exist earlier). My extension Should run after these scripts run so that i can process the final Page version. Hope this makes it clear.
Sergey Alexandrovich Kryukov 31-May-13 10:06am
Thank you, that's closer. I thought it's something like that, but I'm still not quite certain. I guess you should just add some explanation of the context. I don't understand the bigger-picture scenario of you BHO: in what kind of application is works, what object holds the DOM and what's the scope...

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

At best you modify the content before it is loaded.
Alternative you can completly reload the site with the modified DOM.
Daroosh 31-May-13 7:10am
How can i reload the content after it has been modified?

I guess if i knew at which point the page code was modified, I would simply do my processing after that point without having to reload anything. The problem is, the page content is modified after the DOCUMENTCOMPLETE event(Due to scripts running on page) and i can't capture when the process is completed.
KarstenK 31-May-13 7:36am
isnt there a load Load( ) function for the explorer COM-object which has the HMTL for input.

Or re-evalaute your design.
Daroosh 31-May-13 7:44am
The load() document method you are talking about re-triggers the DOCUMENTCOMPLETE event, which will then (according to your solution), modify the DOM and re-load it, which will trigger the DOCUMENTCOMPLETE event again and so on....infinite loop....
KarstenK 31-May-13 7:52am
if ypu cant solve that ptoblem with a flag, you should find another way ....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 415
1 phil.o 170
2 Dave Kreskowiak 155
3 KrunalRohit 134
4 F-ES Sitecore 130
0 OriginalGriff 6,778
1 KrunalRohit 4,530
2 Sergey Alexandrovich Kryukov 3,203
3 George Jonsson 2,815
4 Suvendu Shekhar Giri 2,181

Advertise | Privacy | Mobile
Web02 | 2.8.151120.1 | Last Updated 31 May 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100