admin管理员组文章数量:1410697
I am getting script error in loading some web sites.
Please help me how to prevent script error in C# WebBrowser.
This is my code:
try
{
webBrowser1.Navigate(textBox1.Text);
while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
{
Application.DoEvents();
}
MessageBox.Show("Loaded");
}
catch(Exception)
{
MessageBox.Show("failed");
}
I am getting script error in loading some web sites.
Please help me how to prevent script error in C# WebBrowser.
This is my code:
try
{
webBrowser1.Navigate(textBox1.Text);
while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
{
Application.DoEvents();
}
MessageBox.Show("Loaded");
}
catch(Exception)
{
MessageBox.Show("failed");
}
Share
edited Aug 8, 2012 at 17:03
Mat
207k41 gold badges402 silver badges418 bronze badges
asked Aug 8, 2012 at 16:40
user1576034user1576034
852 gold badges5 silver badges13 bronze badges
5
- 4 I don't suppose you're going to share the script error message, are you? – LittleBobbyTables - Au Revoir Commented Aug 8, 2012 at 16:42
- 1 This is kinda like hiring a plumber and not telling him what was leaking :p – John Humphreys Commented Aug 8, 2012 at 16:44
- 1 @LittleBobbyTables Your name is amazing. – Wesley Commented Aug 8, 2012 at 16:45
- @Wesley:- Wanted to +2 your ment... – perilbrain Commented Aug 8, 2012 at 16:49
- Script error is: An error has occured in the script on this page Do you want to continue running script on this page? – user1576034 Commented Aug 8, 2012 at 16:51
5 Answers
Reset to default 4Write this in Your Code
webBrowser1.ScriptErrorsSuppressed = true;
To disable the script error pop up, you need to go to (in Internet Explorer) Tools->Internet Options, there go to the Advanced tab, and in Browsing select Disable Script Debugging (Other), but, the problem may be related to the fact that every site loaded in the WebBrowser control is rendered in IE7 patibility mode, to solve this the only thing you can do is a registry hack like this: WebBrowser control to use IE9
change your registry to 2af8 which is IE 11 for devenv.exe software/Microsoft/internet explorer/main/featurecontrol/feature_Browser_emulation
If your working with a GUI (like in Visual Studio) just go to the Webbrowser Properties and set "ScriptErrorsSuppressed" = true
It is easy to see how this error has been eliminated. But Visual Studio uses Internet Explorer and another Web Browser coding is hard. If you look at the versions, the last Visual Studio one uses IE 11 for WebBrowser tool.
The C++ GUI is remended for one of each encoding: https://msdn.microsoft./en-us/library/60k1461a.aspx
本文标签: javascriptHow to prevent script error in C webbrowserStack Overflow
版权声明:本文标题:javascript - How to prevent script error in C# webbrowser? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744932142a2632966.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论