Javascript 如何禁用浏览器中的最小化、最大化按钮?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4754823/
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-08-23 13:56:04  来源:igfitidea点击:

How to disable minimize, maximize button in the browser?

javascript

提问by VJS

How to disable minimize, maximize button in the browser?

如何禁用浏览器中的最小化、最大化按钮?

using javascript.

使用javascript。

回答by Jonathon Faust

You cannot (consistently). Deliberately malicious actions are generally restricted by browsers.

你不能(一直)。故意的恶意操作通常受到浏览器的限制。

回答by squillman

window.open("mypage.html","mywindowname", "toolbar=no,menubar=no");

WIll give you a new window without the menubar and without the toolbar. That's what I'm assuming you want when you say "disable". If you just want to disable the functionality while still showing the buttons, then you can't.

将为您提供一个没有菜单栏和工具栏的新窗口。当您说“禁用”时,这就是我假设您想要的。如果您只想在仍然显示按钮的同时禁用该功能,那么您就不能。

Look herefor a reference on the window.open() method.

这里有关window.open()方法的引用。

回答by Tom

Here is another approach, you can send key strokes for Alt, Space,N.

这是另一种方法,您可以发送 Alt、Space、N 的击键。

    <SCRIPT LANGUAGE="JavaScript">

var WshShell = new ActiveXObject("WScript.Shell");
function Minimize()
{
    WshShell.SendKeys("% n");
}
</SCRIPT>

</HEAD>

<BODY >
<TABLE width=100%>
<TR align=right>
    <TD><input type="button" name="Button" onclick="Minimize()" value="minimize" /></TD>
</TR>
</TABLE>

</BODY>

回答by Foad Tahmasebi

For Firefox:

对于火狐:

<script>
    window.open("http://www.google.com/", "Google", "dialog=yes");
</script>