javascript 如何在模式对话框中隐藏地址栏?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4164626/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 10:34:07  来源:igfitidea点击:

How can I hide the address bar in a modal dialog?

javascript

提问by pavan

How can I hide the address bar (location bar ) in a modal dialog? Here is my code:

如何在模式对话框中隐藏地址栏(位置栏)?这是我的代码:

var dialogFeatures = 'center:yes; dialogWidth:600px; location:no;dialogHeight:400px; edge:raised; help:no; resizable:no; scroll:no; status:no; statusbar:no; toolbar:no; menubar:no; addressbar:no; titlebar:no;';
newwindow2 = window.showModalDialog('Combo?start1=' + calEvent.start + '&end1=' + calEvent.end + '&ownerType=' + < %= ApplicationConstants.OWNER_TYPE_CALENDAR % > , 'app', dialogFeatures);

回答by Pekka

It's not possible. The address bar is a security feature in most browsers, in IE since version 7, in Firefox (I think) since version 2.

这是不可能的。地址栏是大多数浏览器中的安全功能,从版本 7 开始在 IE 中,从版本 2 开始在 Firefox 中(我认为)。

回答by Andy E

You can't hide the address bar, location: nois not a valid option for the featuresargument.

您无法隐藏地址栏,location: no这不是features参数的有效选项。

In Internet Explorer 7 and later, all windows opened by the browser have an address bar. The same is true of Google Chrome and other browsers supporting showModalDialog.

在 Internet Explorer 7 和更高版本中,浏览器打开的所有窗口都有一个地址栏。谷歌浏览器和其他支持showModalDialog.

回答by Guffa

You can't.

你不能。

Hiding the address bar is disallowed in most browsers, for security reasons.

出于安全原因,大多数浏览器都不允许隐藏地址栏。

回答by user1543658

in about:config change this parameter:

在 about:config 中更改此参数:

dom.disable_window_open_feature.location
and for menubar and any other components you have to change their feature in about:config

dom.disable_window_open_feature.location
以及菜单栏和任何其他组件,您必须在 about:config 中更改其功能