Hi all
I am currently writing an application that uses the WebBrowser control to perform operations on web pages. Unfortunately I stumbled upon a very annoying problem, sometimes an Internet explorer script error window pops up and stops all execution until you click the OK button. I've searched the web for hours and the same answer came up:
it's easy (so easy, yeah...) just do this:
WebBrowser.Silent = true;
the problem is that WebBrowser does not have a property named silent!!!!!! Maybe it did, but no more! if you don't believe me take a a look at the MSDN.
What you should do is use
WebBrowser.ScriptErrorsSuppressed = true;
which does exists...
Hope this helps some frustrated people (like me).
Happy holidays
Amit
17 comments:
"What you should do is use
WebBrowser.ScriptErrorsSuppressed = true;"
...but it makes things worse
Instead of Script Error Window, You got Visual Studio's debug window (twice per page)
hey dave.
I am not getting this window but i will try and check it out for you
have a great weekend
Amit
You will get it if you'll uncheck both "Disable Script debugging" in the IE advanced settings.
I'm still looking for a way to load html into mshtml object with webcontrol without popping up messages. If you know about a way to load ihtmldocument2 without using webcontrol, it would be great.
Assaf
Why do you want it without the WebControl?
it really worked for me
nice work man
thanks alot
Thank god! this helped alot!
Love you and google!
Thank your very much. This is a main bug for my programe.
It can fix in 1 line ! It work.
wer do u add the peice of code?
I would imagine it would go in where your web browser code is, If your web browser is named "WebBrowser" Go to your code window and click on WebBrowser to expand it and then place that under the rest of the code in there. Hope im right!
Cool!
You can try WatIn instead of web browser control. It is getting better and a good tool for aspnet integration tests.
Thanks for the post!
thanks a lot
Thanks a lot +100 to your carma :)
reflector to the rescue:
FieldInfo fieldInfo = browser.GetType().GetField("_axIWebBrowser2", BindingFlags.Instance | BindingFlags.NonPublic);
dynamic activexObject = fieldInfo.GetValue(browser);
activexObject.Silent = true;
that works fine on my side (.net 4.0 for the dynamic part) otherwise cast approprietly
Keep in mind that using WebBrowser.ScriptErrorsSuppressed = true suppresses ALL message boxes for this WebBrowser control. that includes password entry dialogs.
thanks a lot man.
it solved my problem.
nice work
Thanks a lot. Saved me lot of time..Sharing is caring.. :)
Post a Comment