使用WebBrowser.ExecWB产生的问题
登陆画面中,登陆成功后,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));
}