在IE C#中运行的WebBrowser [英] WebBrowser runn in IE C#

查看:165
本文介绍了在IE C#中运行的WebBrowser的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WebBrowser web = new WebBrowser();
web.NewWindow += new CancelEventHandler(web_NewWindow);
web.Navigate(websiteURL);

while (web.ReadyState != WebBrowserReadyState.Complete)
{
   Application.DoEvents();
}



在我的带下划线的行中,出现一条消息错误,内容为:


_ Internet Explorer脚本错误 ______________
此页面上的脚本中发生错误.
行:4
字符:10997
错误:"null"为null或不是对象
网址:(websiteURL)

您要继续在此页面上运行脚本吗?
____ ____
|是| |否|
_____________________________________

请帮助我运行:



Hi, in my underlined line, it comes a message error that says:


_Internet Explorer Script Error______________
An error occurred in the script on this page.
Line: 4
Char: 10997
Error: ''null'' is null or not an object
URL: (websiteURL)

Do you want to continue running scripts on this page?
____ ____
|YES | |NO|
_____________________________________

Please help me to run my:

WebBrowser web = new WebBrowser();


在Firefox中...还是我该如何中止此消息?


in Firefox... or how can I just abort this message?

推荐答案

您好,

WebBrowser控件甚至您的代码都不会出现问题.您尝试加载的网页存在问题.该页面显然包含一个JavaScript错误,因此当发生此错误时,WebBrowser控件只是为您提供了停止运行该页面的选项.因此,您有两个选择:
1)忽略该错误并继续显示页面.这可能会导致页面的某些位不起作用,但这将意味着该页面显示出来.如果可以编辑页面,请执行此操作并解决错误:)
2)通过告诉用户并为用户提供选项或重定向其他页面来处理错误.

希望这会有所帮助,
Ed
Hi there,

This sin''t a problem with the WebBrowser control, or even your code. It is a problem with the web page you are trying to load. The page evidently contains a JavaScript error so when this error occurs the WebBrowser control is just giving you the option to stop running the page. You have two options therefore:
1) Ignore the error and continue to show the page. This may result in some bits of the page not working but it will mean that the page shows. If you can edit the page, do so and fix the error :)
2) Handle the error by telling the user and giving the user the option or redirecting a different page.

Hope this helps,
Ed


这篇关于在IE C#中运行的WebBrowser的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆