473,385 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

AxWebBrowser & Hide Javascript error windows

Hi,

I'm using the AxWebBrowser Control from microsoft in a C# application.
It works fine, but i have many problems to hide the javascript error
windows that appear when u visit a website with... javascript errors :)

I can catch errors coming from website that does not use frames using :
private void NavigateComplete(object
sender,AxSHDocVw.DWebBrowserEvents2_NavigateComple te2Event e)
{
mshtml.IHTMLDocument2 doc;
doc = (mshtml.IHTMLDocument2)browser.Document;
mshtml.IHTMLWindow2 window=doc.parentWindow;
HTMLWindowEvents_Event ievent =(HTMLWindowEvents_Event)window;
ievent.onerror+=new
HTMLWindowEvents_onerrorEventHandler(this.WindowEr ror);
}

private void WindowError(string t, string i, int s)
{
//Console.WriteLine("Erreur trouvee");
mshtml.IHTMLDocument2 doc;
doc = (mshtml.IHTMLDocument2)browser.Document;
mshtml.IHTMLWindow2 window=doc.parentWindow;
((IHTMLEventObj)window.@event).returnValue=true;
}

But it does NOT works with websites with Frames.
So i tried to set the event handler on frames too, using :
private void NavigateComplete(object
sender,AxSHDocVw.DWebBrowserEvents2_NavigateComple te2Event e)
{

mshtml.IHTMLDocument2 doc;
doc = (mshtml.IHTMLDocument2)browser.Document;

int index = 0;
object o =index ;
object o2 =index ;

if (doc.frames.length>0)
{
for (int i=0;i<doc.frames.length;i++)
{
o=i;
IHTMLWindow2 frame = (IHTMLWindow2)doc.frames.item(ref o);

if (frame.frames.length>0)
{
for (int j=0;j<frame.frames.length;j++)
{

o2=j;
IHTMLWindow2 frame2 = (IHTMLWindow2)frame.frames.item(ref o);
HTMLWindowEvents_Event ievent3
=(HTMLWindowEvents_Event)frame2;
ievent3.onerror+=new
HTMLWindowEvents_onerrorEventHandler(this.WindowEr ror);
}
}

HTMLWindowEvents_Event ievent2 =(HTMLWindowEvents_Event)frame;
ievent2.onerror+=new
HTMLWindowEvents_onerrorEventHandler(this.WindowEr ror);

}
}

mshtml.IHTMLWindow2 window=doc.parentWindow;
HTMLWindowEvents_Event ievent =(HTMLWindowEvents_Event)window;
ievent.onerror+=new
HTMLWindowEvents_onerrorEventHandler(this.WindowEr ror);
}

(ErrorWindow is still the same than before)

But it STILL doesn't work :(

Does someone know why it does not work?
How to fix this??
Help ! :)

F.Mestayer

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #1
3 10385
bad idea but you can hook into the window.error handler and swallow the
error. it's bad because everything gets swallowed. it's good for you because
it will get rid of the script errors.

"dricks dr" <dr********@hotmail.com> wrote in message
news:O0*************@TK2MSFTNGP11.phx.gbl...
Hi,

I'm using the AxWebBrowser Control from microsoft in a C# application.
It works fine, but i have many problems to hide the javascript error
windows that appear when u visit a website with... javascript errors :)

I can catch errors coming from website that does not use frames using :
private void NavigateComplete(object
sender,AxSHDocVw.DWebBrowserEvents2_NavigateComple te2Event e)
{
mshtml.IHTMLDocument2 doc;
doc = (mshtml.IHTMLDocument2)browser.Document;
mshtml.IHTMLWindow2 window=doc.parentWindow;
HTMLWindowEvents_Event ievent =(HTMLWindowEvents_Event)window;
ievent.onerror+=new
HTMLWindowEvents_onerrorEventHandler(this.WindowEr ror);
}

private void WindowError(string t, string i, int s)
{
//Console.WriteLine("Erreur trouvee");
mshtml.IHTMLDocument2 doc;
doc = (mshtml.IHTMLDocument2)browser.Document;
mshtml.IHTMLWindow2 window=doc.parentWindow;
((IHTMLEventObj)window.@event).returnValue=true;
}

But it does NOT works with websites with Frames.
So i tried to set the event handler on frames too, using :
private void NavigateComplete(object
sender,AxSHDocVw.DWebBrowserEvents2_NavigateComple te2Event e)
{

mshtml.IHTMLDocument2 doc;
doc = (mshtml.IHTMLDocument2)browser.Document;

int index = 0;
object o =index ;
object o2 =index ;

if (doc.frames.length>0)
{
for (int i=0;i<doc.frames.length;i++)
{
o=i;
IHTMLWindow2 frame = (IHTMLWindow2)doc.frames.item(ref o);

if (frame.frames.length>0)
{
for (int j=0;j<frame.frames.length;j++)
{

o2=j;
IHTMLWindow2 frame2 = (IHTMLWindow2)frame.frames.item(ref o);
HTMLWindowEvents_Event ievent3
=(HTMLWindowEvents_Event)frame2;
ievent3.onerror+=new
HTMLWindowEvents_onerrorEventHandler(this.WindowEr ror);
}
}

HTMLWindowEvents_Event ievent2 =(HTMLWindowEvents_Event)frame;
ievent2.onerror+=new
HTMLWindowEvents_onerrorEventHandler(this.WindowEr ror);

}
}

mshtml.IHTMLWindow2 window=doc.parentWindow;
HTMLWindowEvents_Event ievent =(HTMLWindowEvents_Event)window;
ievent.onerror+=new
HTMLWindowEvents_onerrorEventHandler(this.WindowEr ror);
}

(ErrorWindow is still the same than before)

But it STILL doesn't work :(

Does someone know why it does not work?
How to fix this??
Help ! :)

F.Mestayer

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 15 '05 #2
why not try set WebBrowser Silent to true?
"Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com > wrote in
message news:e0*************@TK2MSFTNGP11.phx.gbl...
bad idea but you can hook into the window.error handler and swallow the
error. it's bad because everything gets swallowed. it's good for you because it will get rid of the script errors.

"dricks dr" <dr********@hotmail.com> wrote in message
news:O0*************@TK2MSFTNGP11.phx.gbl...
Hi,

I'm using the AxWebBrowser Control from microsoft in a C# application.
It works fine, but i have many problems to hide the javascript error
windows that appear when u visit a website with... javascript errors :)

I can catch errors coming from website that does not use frames using :
private void NavigateComplete(object
sender,AxSHDocVw.DWebBrowserEvents2_NavigateComple te2Event e)
{
mshtml.IHTMLDocument2 doc;
doc = (mshtml.IHTMLDocument2)browser.Document;
mshtml.IHTMLWindow2 window=doc.parentWindow;
HTMLWindowEvents_Event ievent =(HTMLWindowEvents_Event)window;
ievent.onerror+=new
HTMLWindowEvents_onerrorEventHandler(this.WindowEr ror);
}

private void WindowError(string t, string i, int s)
{
//Console.WriteLine("Erreur trouvee");
mshtml.IHTMLDocument2 doc;
doc = (mshtml.IHTMLDocument2)browser.Document;
mshtml.IHTMLWindow2 window=doc.parentWindow;
((IHTMLEventObj)window.@event).returnValue=true;
}

But it does NOT works with websites with Frames.
So i tried to set the event handler on frames too, using :
private void NavigateComplete(object
sender,AxSHDocVw.DWebBrowserEvents2_NavigateComple te2Event e)
{

mshtml.IHTMLDocument2 doc;
doc = (mshtml.IHTMLDocument2)browser.Document;

int index = 0;
object o =index ;
object o2 =index ;

if (doc.frames.length>0)
{
for (int i=0;i<doc.frames.length;i++)
{
o=i;
IHTMLWindow2 frame = (IHTMLWindow2)doc.frames.item(ref o);

if (frame.frames.length>0)
{
for (int j=0;j<frame.frames.length;j++)
{

o2=j;
IHTMLWindow2 frame2 = (IHTMLWindow2)frame.frames.item(ref o);
HTMLWindowEvents_Event ievent3
=(HTMLWindowEvents_Event)frame2;
ievent3.onerror+=new
HTMLWindowEvents_onerrorEventHandler(this.WindowEr ror);
}
}

HTMLWindowEvents_Event ievent2 =(HTMLWindowEvents_Event)frame;
ievent2.onerror+=new
HTMLWindowEvents_onerrorEventHandler(this.WindowEr ror);

}
}

mshtml.IHTMLWindow2 window=doc.parentWindow;
HTMLWindowEvents_Event ievent =(HTMLWindowEvents_Event)window;
ievent.onerror+=new
HTMLWindowEvents_onerrorEventHandler(this.WindowEr ror);
}

(ErrorWindow is still the same than before)

But it STILL doesn't work :(

Does someone know why it does not work?
How to fix this??
Help ! :)

F.Mestayer

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 15 '05 #3
Thanx for replying :)

@Alvin Bruney :
I dont understand what you mean with 'hook window error handler'. Could
you precise this please? It should be the right way to avoid those
annoying messages :)

@unknown user :
I can't use Silent=true property because it hides ALL message box,
including login//password message box of web sites, which is annoying :/

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Gary Varga | last post by:
In the file WebUIValidation.js, when a postback that doesn't fail the validation has a javascript error saying summary is undefined in the ValidationSummaryOnSubmit function....
4
by: Ian Cox | last post by:
I have a web form that contains a Datagrid. This grid has a number of columns, one of which contains a text box and validator for that text box. Everything works fine, when I press the "Save"...
14
by: Rich | last post by:
I am converting my enterprise solution from VS 2003 (.NET v1.1.4322) to VS 2005 (.NET v2.0.50727). The entire solution uses serveral technologies - Windows Server 2003 (AD, SQL Server 2000, IIS,...
0
by: news.microsoft.com | last post by:
I am going crazy trying to figure this out, and I am wondering if this is a bug in the ASP.Net implementation. My situation: I have an ASPX page with 2 different modes: *Mode 1: Datagrid...
0
by: Chris S | last post by:
I am going crazy trying to figure this out, and I am wondering if this is a bug in the ASP.Net 1.1 implementation. My situation: I have an ASPX page with 2 different modes: *Mode 1:...
1
by: Josh | last post by:
I'm trying to trigger an onSubmit function from a form using Javascript. As far as I know the only way to do this is to hide a submit button and then use 'button'.click() on the submit button to...
2
by: ZeeHseez | last post by:
Hi, I have written a webbrowser application in VB .net Framework 1.1. I would like to suppress javascript error messages. However, the silent property of the webbrowser control suppresses the...
47
by: SOLAV | last post by:
This is the only working way to completely hide your JavaScript code from the client just like PHP or ASP code. Here we'll need the help of PHP. Here is the code: index.php...
4
by: miraan | last post by:
Hi, I am getting a javascript error but my page works perfectly fine and nothing is wrong, how do i hide the javascript error pop up window that appears when you visit the web page?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.