javascript 打开一个没有地址栏的新窗口
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25934277/
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
open a new window without address bar
提问by Rij
I am looking for HTML/JavaScript code to open a new window with only a "close" option; users should not able to maximize or minimize the window. This is similar to the window which we get in Internet Explorer in Tools -> About Internet Explorer
.
我正在寻找 HTML/JavaScript 代码来打开一个只有“关闭”选项的新窗口;用户不应能够最大化或最小化窗口。这类似于我们在 Internet Explorer 中获得的窗口Tools -> About Internet Explorer
。
Below is the code which I tried; however, I can increase/decrease the width of the window using mouse or by using the maximize/minimize buttons. How can I disable those options?
下面是我试过的代码;但是,我可以使用鼠标或使用最大化/最小化按钮来增加/减少窗口的宽度。如何禁用这些选项?
<SCRIPT>
<!--
window.open ('titlepage.html', 'newwindow', config='height=100,width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, directories=no, status=no')
-->
</SCRIPT>
回答by luke_mclachlan
I'll risk answering this for you, though it's my first time answering so go easy on me (I would comment but my reputation isn't high enough).
我会冒险为您回答这个问题,尽管这是我第一次回答,所以请放轻松(我会发表评论,但我的声誉不够高)。
this feature is supported only on IE, i.e. for example in Chrome and Firefox the user can still resize the window even with 'resizable=no'. If you do a search on SO you'll find that this has been asked many times before, for example. Make window not resizable in Chrome
此功能仅在 IE 上受支持,即例如在 Chrome 和 Firefox 中,即使使用“resizable=no”,用户仍然可以调整窗口大小。例如,如果您在 SO 上进行搜索,您会发现之前已经多次询问过这个问题。 使窗口无法在 Chrome 中调整大小
therefore to do what you're wanting to do I would probably use an external script, such as Popup.js, which supports ajax.
因此,要执行您想要执行的操作,我可能会使用支持 ajax 的外部脚本,例如 Popup.js。
as a footnote, you may want to refer to the W3 guide on window.open: http://www.w3schools.com/jsref/met_win_open.asp
作为脚注,您可能需要参考 window.open 上的 W3 指南:http: //www.w3schools.com/jsref/met_win_open.asp