Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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:
DISPID_DOCUMENTCOMPLETE
DISPID_NAVIGATECOMPLETE2

Thanks in advance!
Posted
Comments
Sergey Alexandrovich Kryukov 31-May-13 9:26am    
Not clear why? And, if all scripts are already complete, what do you call that is executed after it? :-)
—SA
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...
—SA

1 solution

At best you modify the content before it is loaded.
Alternative you can completly reload the site with the modified DOM.
 
Share this answer
 
Comments
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900