再发贴求助!winform WebBrowser加载js出错

cuisea 2011-08-04 03:11:18
创建了一个weather.aspx,内容如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="weather.aspx.cs" Inherits="WebApplication.weather" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<script src="res://mshtml.dll/objectembed_neutral.js"></script>
</head>
<body objectSource="http://flash.weather.com.cn/wmaps/index.swf" onload="ObjectLoad();" leftmargin=0 topmargin=0 scroll=no>
<form id="objectDestination"></form>
</body>
</html>

此页面在IE7下可以正常浏览。接下来创建一个Winform,使用WebBrowser控件打开weather.aspx页面,结果报JS错误:

调试发现找不到ObjectLoad()函数(该函数在res://mshtml.dll/objectembed_neutral.js中)。
将weather.aspx页面的代码放到静态页面test.html里,可以正常浏览,再使用WebBrowser控件打开test.html页面也可以正常浏览。现在就困惑了,WebBrowser打开动态页面怎么就加载不了“res://mshtml.dll/objectembed_neutral.js”,有人遇到过类似情况吗?期待高人指点!非常感谢!
...全文
947 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
wtoeb 2013-06-28
  • 打赏
  • 举报
回复
private void RadForm1_Load(object sender, EventArgs e)
{
    try
    {
        this.About_webBrowser_Map.Url = new Uri(ConfigurationManager.AppSettings["ctmmap"]);
        this.About_webBrowser_Map.ScriptErrorsSuppressed = false;
    }
    catch
    {
    }
}
cuisea 2011-08-22
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 yershop 的回复:]
老兄,搞定了没有,我也碰到这样的问题啦
[/Quote]
看前一篇帖子http://topic.csdn.net/u/20110804/10/5ca1d34f-b9c6-417e-a3f7-ac2fb293d57e.html
解决方法:添加信任站点
yershop 2011-08-22
  • 打赏
  • 举报
回复
老兄,搞定了没有,我也碰到这样的问题啦
longbin891012 2011-08-05
  • 打赏
  • 举报
回复
允许JS代码的执行,忘记个属性了,
viki117 2011-08-05
  • 打赏
  • 举报
回复
允许JS代码的执行,忘记个属性了,实在不行就屏蔽掉错误
无趣 2011-08-05
  • 打赏
  • 举报
回复
接分来了,呵呵
PSSonyXbox 2011-08-04
  • 打赏
  • 举报
回复
把你的js代码发上来

110,566

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧