axWebbrowser - HTMLWindowEvents catch and control -HOWTO?

G

Guest

Hello. I need a little help to get this thing finished. Im trying to catch
js errors and the event works as expected. However I have created an event
from doc.parentWindow but when it fires im unable to suppress it using a
returnValue = true.

Im navigating to an URI using axWebBrowser1.Navigate(txtURI.Text, ref
nullObject, ref nullObjStr, ref nullObjStr, ref nullObjStr);

My code:
mshtml.CEventObj CEobj;
mshtml.HTMLWindowEvents2_Event iEvent2;
private void NavigateComplete(object sender,
AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e)

{
mshtml.HTMLDocument doc;
doc = (mshtml.HTMLDocument)axWebBrowser1.Document;
iEvent2 = (mshtml.HTMLWindowEvents2_Event) doc.parentWindow;
iEvent2.onerror += new
mshtml.HTMLWindowEvents2_onerrorEventHandler(iEvent2_onerror);
}

When this iEvent2 fires:

private void iEvent2_onerror(string description, string url, int line)
{
label1.Text = "Err";
CEobj = (mshtml.CEventObj)iEvent2 ;
CEobj.returnValue = true;
}

As you can see im trying to set the returnValue = true but it stills opens a
new window telling me that there's an error onm the page. How do I suppress
that?

I've read that returnValue = true should do it here:
http://support.microsoft.com/?kbid=279535



Kind regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top