views:

91

answers:

0

I'm developing a plugin for IE (BHO and toolbar) which involves some modifications to the cache and content compression through an external service. I need to be able to show some graphs that demonstrate the bandwidth that is being saved by doing this on a per page basis, to include all of the images and other content on the page.

Using the web browser events BEFORENAVIGATE2 and NAVIGATECOMPLETE2/DOCUMENTCOMPLETE and such don't seem to cut the mustard since they aren't fired when the page is refreshed, only when navigating to a new page.

So what are some good ways to handle this, if any?

Edit: I discovered a way to determine if the page is being refreshed, and to fire an event when it's loaded.

Rough Steps:

1) In OnBeforeNavigate2, set a flag to indicate a "normal" page load if the IDispatch parameter is equal to main frame window.

2) In OnDownloadBegin, check the flag set in the above step. If it is set to normal, then exit. if not, we check the document in the main frame to see if it has a ready state of "complete". If it does, then we exit. If not, then we can assume that the page is being refreshed.

3) If we determine that the page is being refreshed, then we hook an event sink to the frame window to capture HTMLWindowEvents2 events.

4) When the "onload" event is fired in the above sink, then we know that the document is complete.

I can probably accomplish what I need by using that mechanism, but I'll keep this open for a while in case there are other answers.