Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ C IE9 Extensions 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:
DISPID_DOCUMENTCOMPLETE
DISPID_NAVIGATECOMPLETE2
 
Thanks in advance!
Posted 31-May-13 1:43am
Daroosh659
Comments
Sergey Alexandrovich Kryukov at 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 at 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 at 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

Rate this: bad
good
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.
  Permalink  
Comments
Daroosh at 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 at 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 at 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 at 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 304
1 Sergey Alexandrovich Kryukov 255
2 Shweta N Mishra 216
3 Maciej Los 210
4 PIEBALDconsult 184
0 OriginalGriff 7,660
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,586
3 Manas Bhardwaj 4,946
4 Maciej Los 4,665


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 31 May 2013
Copyright © CodeProject, 1999-2014
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