浏览器助手对象和AJAX

I am wondering if BeforeNavigate2 or DocumentComplete events should fire on pages with AJAX. For example google maps. When I put something in addressbar everything is ok, but when I move the map and resizing it nothing happens (DocumentComplete and BeforeNavigate2 does not fire), but data is sent to and from Internet.

The a in ajax stands for asynchronous. These events fire in response to synchronous methods completing. Since an asynchronous request can be made at any time the browser has no way of knowing when they are all completed.

I think you need to handle ajax request and you can Handle with DownloadBegin and DownloadComplete Event.

In Code:

public int SetSite(object site)
{
   if (site != null)
   {
      webBrowser = (WebBrowser)site;
      webBrowser.DownloadComplete += new DWebBrowserEvents2_DownloadCompleteEventHandler(DownloadComplete);
      webBrowser.DownloadBegin += new DWebBrowserEvents2_DownloadBeginEventHandler(DownloadBegin);
   }
   else
   {
      webBrowser.DownloadComplete += new DWebBrowserEvents2_DownloadCompleteEventHandler(DownloadComplete);
      webBrowser.DownloadBegin += new DWebBrowserEvents2_DownloadBeginEventHandler(DownloadBegin);
      webBrowser = null;
   }
   return 0;
}

Events:

private void DownloadBegin()
{
   MessageBox.Show("Download Begin");
}
private void DownloadComplete()
{
   MessageBox.Show("Download Complete");
}

it's work for me.

I monitor download begin and download complete events to process pages which include ajax codes. Also need program logic to control the flow, e.g.. set/check flags.