search

Home  >  Q&A  >  body text

window.resizeTo has no effect - Stack Overflow

<html>
<button onclick="closes()">create</button>
<button onclick="tos()">change</button>

<script>
function closes()
{
    window.open("","myname","width=400, height=400");

}
function tos()
{
    window.resizeTo(700,200);

}
</script>
</html>

window.resizeTo cannot resize the window, what's going on?
Thanks

滿天的星座滿天的星座2768 days ago921

reply all(2)I'll reply

  • 巴扎黑

    巴扎黑2017-06-26 10:55:55

    var win;
    function closes()
    {
        win = window.open("","myname","width=400, height=400");
    
    }
    function tos()
    {
        win.window.resizeTo(700,200);
    
    }
    }

    reply
    0
  • 阿神

    阿神2017-06-26 10:55:55

    Check out MDN

    Learn
    Starting from Firefox 7, the size of the browser window cannot be changed. The following rules must be followed:

    1. The size of windows or Tabs not created through window.open cannot be set.

    2. When a window contains more than one Tab, the window size cannot be set.

    That is, the window size that can be changed by resizeTo or resizeBy is only those pages opened with window.open, and the window opened by window.open can only have one tab

    reply
    0
  • Cancelreply