javascript 如何为打开的新窗口禁用最大化、最小化和关闭按钮
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11844823/
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
How to disable maximize,mimimize and close button for a new window open
提问by chirag jain
I am using window.open()
method to open a page as a pop-up window for a link button click event.
But the poup-up window is having minimize,maximize,close(x) button.
我正在使用window.open()
方法打开一个页面作为链接按钮单击事件的弹出窗口。但是弹出窗口有最小化、最大化、关闭(x)按钮。
I dont want those buttons. How can remove these buttons?
我不要那些按钮。如何删除这些按钮?
This is the method i am using,
这是我正在使用的方法,
window.open(url,"Link","toolbar=0,location=0,directories=0,status=0,menubar=0,titlebar=no,scrollbars=1,resizable=0,width=450,height=310,left=500,top=350");
Tell me how can do this.
告诉我怎么做。
Regards, Chirag Jain.
问候,奇拉格耆那教。
回答by Alnitak
You can't.
你不能。
If you want a popup stylewindow without full window decorations you'd have to create a new overlay <div>
on top of the existing content and fill that with content, perhaps using an <iframe>
.
如果你想要一个没有完整窗口装饰的弹出式窗口,你必须<div>
在现有内容的顶部创建一个新的覆盖层并用内容填充它,可能使用<iframe>
.
回答by Jon Hanna
You can't do it from javascript alone. Think about it, if you could, then people could put it into code on web-pages and cause other people's computers to open windows they couldn't easily close.
你不能单独从 javascript 中做到这一点。想想看,如果可以的话,人们就可以把它写成网页上的代码,让其他人的电脑打开他们无法轻易关闭的窗口。
Instead you'll have to look for an answer specific to whichever browser you're using to host this application, and change it on the computers of your users appropriately. Even then though I don't think you'll be in luck (with Firefox for example, I can see how to get rid of them on all browser windows, but not on just one).
相反,您必须寻找特定于您用于托管此应用程序的浏览器的答案,并在用户的计算机上适当地更改它。即便如此,我认为你不会走运(例如,使用 Firefox,我可以看到如何在所有浏览器窗口上摆脱它们,但不仅仅是在一个窗口上)。