简体   繁体   中英

change size browser window

How can I change the size of the browser window? I tried like this:

   <!doctype html>
   <head>
<title>Index</title>
<!--<script>
   function changeScreenSize(w,h)
     {
       window.resizeTo( w,h )
     }
</script>-->
</head>   
<body onload="changeScreenSize(800,600) ">

<div id="container">
        <h1>Title</h1>
        <p>hi</p>
    </div>

</body>  
</html>

but it only works with safari and the window is resizable. With other browsers it does not work

I have to create a 800x600 window not resizable and no scroll ... maybe without the edges of the browser

how can I do this?

You should use resizeTo , but it works only in newly created windows, as far as I know...

Its usage is heavily restricted by some browsers for obvious reasons.

 <script> var window1; function firstopen() { window1= window.open("", "", "width=100, height=100"); } function thenresize() { window1.resizeTo(590, 590); window1.focus(); } 
 <button onclick="firstopen()">open</button> <button onclick="thenresize()">resize</button> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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