Q:

BHO Plugin not working properly

I have implement BHO Plugin to detect NUmber from webpage using C#.Every time page loaded append javascript in webpage and that javascript detect number and replaced it with hyperlink number.
Code
 public void  WebBrowser_DownloadComplete()
{
HTMLDocument document = (HTMLDocument)webBrowser.Document;

    IHTMLElement head = (IHTMLElement)((IHTMLElementCollection)
                           document.all.tags("head")).item(null, 0);
    IHTMLScriptElement scriptObject = 
      (IHTMLScriptElement)document.createElement("script");
    scriptObject.type = @"text/javascript";
    scriptObject.src = @"myscript.js";
((HTMLHeadElement)head).appendChild((IHTMLDOMNode)scriptObject);

}

Problems
When I test Plugin with offline web pages it is working Fine. But with online pages it is not working. DownloadComplete event triggers multiple time.
Questions
Which event is triggered by IE when page is refresh and loaded? 

A:

You have to add condition in DocumentLoaded event like below,
if (rootDocLoaded && (HTMLDocument != null) && url != "about:blank"){
  //Your code here
}

Using above condition its called only one after full page loaded. And you can also use beforeNavigate and Navigate method also.

