简体   繁体   English

如何在浏览器中禁用最小化,最大化按钮?

[英]How to disable minimize, maximize button in the browser?

How to disable minimize, maximize button in the browser? 如何在浏览器中禁用最小化,最大化按钮?

using javascript. 使用javascript。

You cannot (consistently). 你不能(一贯地)。 Deliberately malicious actions are generally restricted by browsers. 故意恶意行为通常受到浏览器的限制。

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 here for a reference on the window.open() method. 在这里查看window.open()方法的参考。

For Firefox: 对于Firefox:

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

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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM