在弹出的窗口隐藏地址栏 [英] Hiding Address bar in popup window

查看:690
本文介绍了在弹出的窗口隐藏地址栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

net application, in which i am using some popup windows to open some pages. For this, i am using a method like this

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函数为这样的:

JavaScript function as this:

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 ..

Now its working as fine with showing the address bar. But my requirement is that i have to hide the address bar in all of my popup window. Is this possible? Please help by providing one solution. thanks in davance..

推荐答案

反正用 System.Text.StringBuilder 而不是字符串连接。

Anyway use System.Text.StringBuilder instead of string concatenation.

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();

这篇关于在弹出的窗口隐藏地址栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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