Minimize browser window using Javascript

只愿长相守 提交于 2019-12-28 06:45:11

问题


Is there a Javascript or jQuery method to minimize the current browser window?


回答1:


There is no way to minimize the browser window within javascript.

There are ways to change the size of the window, but no true minimization (nice word)




回答2:


No, there isn't. However, depending on what you're doing and which browsers you're targeting, you could play around with the blur and focus events of the window to achieve similar effect.




回答3:


If you use an extension, then you can minimize by chrome.windows.update(window.id, { state: 'minimized' })




回答4:


I hope this is what you are looking for:

<SCRIPT LANGUAGE="JavaScript">

function Minimize()
{
window.innerWidth = 100;
window.innerHeight = 100;
window.screenX = screen.width;
window.screenY = screen.height;
alwaysLowered = true;
}

function Maximize()
{
window.innerWidth = screen.width;
window.innerHeight = screen.height;
window.screenX = 0;
window.screenY = 0;
alwaysLowered = false;
}
</SCRIPT>

<A HREF="javascript:onClick=Minimize()">Minimize</A>
<A HREF="javascript:onClick=Maximize()">Maximize</A> 


来源:https://stackoverflow.com/questions/601790/minimize-browser-window-using-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!