使用WebBrowser.ExecWB产生的问题

wully224 2009-10-28 03:04:06
登陆画面中,登陆成功后,window.open出子窗口,同时关闭父窗口(登陆画面)。因为是IE7的关系,用window.close会出现关闭的提示消息框。

网上找到方法,用ExecWB(45,1),可以解决。
但是会出现一个问题,运行本地代码OK。运行服务器上的,或者本地的localhost改成IP,登陆成功后,父画面关不掉,出现一个IE的警告信息,说“activex控件被ie阻止”(block应该是阻止的意思吧?)
我加入信任的网站,也没用。某人IE6,个别人IE7都正常。请问是什么情况?如何解决?最好是通过代码解决,而不是修改IE设置。


前台代码:
<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>

后台(c#)
private void ShowMainFrame()
{
StringBuilder strScript = new StringBuilder();
ClientScriptManager cs = Page.ClientScript;
System.Type cstype = this.GetType();

strScript.Append("<script type=\"text/javascript\">");
strScript.Append("var wid=window.screen.availWidth - 10;");
strScript.Append("var hei=window.screen.availHeight - 40;");
strScript.Append(" window.open(\"../../MN/MN_010.aspx\",\"blank\",\"Width=\"+wid+\", height=\"+hei+\",status=0,help=0,Left=0px,Top=0px,toolbar= no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no\",\"_self\");");

strScript.Append("document.all.WebBrowser.ExecWB(45,1);");
strScript.Append("</script>");
cs.RegisterClientScriptBlock(cstype, "ClientScript", System.Convert.ToString(strScript));


}
...全文
227 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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