.NET应用程序,其中我使用一些弹出窗口打开一些网页。对于这一点,我使用这样

的方法
private void OpenWindow(string Url, string height, string Width)
{
    try
    {
        string strScript = "";
        strScript += "<script language=\"javascript\">";
        strScript += "eval(\"popUpWindow('" + Url + "',0,0," + Width + "," + height + ",directories=no)\");";
        strScript += "</script>";
        lblScript.Text = strScript;
    }
    catch (Exception ex)
    {
        LogError.Log(ex);
        throw;
    }
}

JavaScript函数为这样:

var popUpWin = 0;

function popUpWindow(URLStr, left, top, width, height, windowName) {
    left = (screen.width / 2) - width / 2;
    top = (screen.height / 2) - height / 2;
    if (popUpWin) {
        if (!popUpWin.closed)
            popUpWin.close();
    }
    popUpWin = open(URLStr, windowName, 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width=' + width + ',height=' + height + ',left=' + left + ', top=' + top + ',screenX=' + left + ',screenY=' + top + '');
    popUpWin.focus();
}

现在其工作与表示地址栏细。但我的要求是,我不得不隐藏在我所有的弹出窗口的地址栏中。这可能吗?通过提供一个解决方案,请帮助。感谢在davance ..

有帮助吗?

解决方案

反正使用System.Text.StringBuilder代替字符串连接。

var sb = new StringBuilder();
sb.Append("<script language=\"javascript\">");
sb.AppendFormat("eval(\"popUpWindow('{0}',0,0,{1},{2},directories=no)\");", url, width, height);
sb.Append("</script>");
lblScript.Text = sb.ToString();

其他提示

没有,这是不可能的。 IIRC安全特征是在IE 6引入。

下面是一些先前的讨论:

如何隐藏地址栏在一个模式对话框?结果 不能隐藏状态栏在做windows.open上IE8 结果 弹出窗口,如何在IE8 隐藏地址栏

这取决于你试图用完成这个浏览器。

旧的浏览器将允许这一点,但现在是一个天,比没有更多次,浏览器将继续显示在地址栏中。其中的一个原因,这是为了使之更难以让用户觉得你呈现真实的应用程序(病毒扫描程序?!?),而不是一个网站。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top