Minimize browser window using Javascript

前端 未结 4 559
耶瑟儿~
耶瑟儿~ 2020-12-06 11:40

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

相关标签:
4条回答
  • 2020-12-06 12:10

    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)

    0 讨论(0)
  • 2020-12-06 12:12

    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> 
    
    0 讨论(0)
  • 2020-12-06 12:19

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

    0 讨论(0)
  • 2020-12-06 12:22

    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.

    0 讨论(0)
提交回复
热议问题