none
Problems with documentcomplete and beforenavigate of a popup window

    Question

  • Hi,

    I implemented a BHO that logs the Events of the DWebBrowserEvents2 Interface of every IE instance in a seperate file.
    For each new instance started by clicking the IE shortcut it works fine. And I get the following log file:

    Code Snippet

    BeforeNavigate2:     about:blank

    TitleChange:         about:blank

    NavigateComplete2:   about:blank
    TitleChange:         about:blank
    DocumentComplete:    about:blank
    BeforeNavigate2:     http://www.google.de/
    TitleChange:         about:blank
    NavigateComplete2:   http://www.google.de/
    TitleChange:         Google
    DocumentComplete:    http://www.google.de/


    Now I built a own html page with the following link:

    Code Snippet

    <a href="http://www.google.de" target="_blank">Google</a>


    After clicking the link the new log file is created and the following log is written:

    Code Snippet

    BeforeNavigate:     http://www.google.de/
    TitleChange:        http://www.google.de/
    DocumentComplete:   http://www.google.de/
    TitleChange:        http://www.google.de/
    NavigateComplete:   http://www.google.de/
    TitleChange:        http://www.google.de/
    TitleChange:        Google
    DocumentComplete:   http://www.google.de/


    How is it possible that there are two "DocumentComplete" and only one "BeforeNavigate" events?

    Does anyone have a suggestion? It would be nice if you could share it with me...

    Thx, Matts



    Tuesday, May 20, 2008 12:40 PM

All replies

  • Because DWebBrowserEvents2 sucks.

    If you only want the ones for the outer navigate, compare the IWebBrowser2 pointer that is passed in with the IWebBrowser2 that you can query from your site in the SetSite() call.  Compare them by compairing their IUnknown pointers (COM rules).
    Tuesday, May 20, 2008 5:11 PM
  • hi jeffdav,

    thx for your reply,

    I tried to get the times between "BeforeNavigate" and "DocumentComplete" for each single frame of a page and of course the toplevel events.

    Therefore I compared the IDispatch pointers for each frame. Now there was the problem with the two "DocumentComplete" events in the popup window.

    Is there an alternative to the DWebBrowserEvents2?
    Monday, May 26, 2008 8:30 AM
  • Only the IUnknowns are garunteed to be equal if it is the same object.

     

    Tuesday, May 27, 2008 6:23 PM