Window resizeBy()Method
Window Object
Example
Open a new window and reset the width and height of the browser window:
function openWin() {
myWindow = window.open("", "", "width=100, height=100");
}
function resizeWin() {
myWindow.resizeBy(250, 250);
}
Try it Yourself »
Definition and Usage
The resizeBy() method is used to resize the window by a specified number of pixels.
Note:This method specifies the pixels by which the bottom-right corner of the specified window moves; the top-left corner will not be moved (it stays at its original coordinates).
Syntax
resizeBy(width,height)
| Parameter | Description |
|---|---|
| width | Required. The number of pixels by which to increase the window width. Can be a positive or negative number. |
| height | Optional. The number of pixels by which to increase the window height. Can be a positive or negative number. |
Browser Support
All latest versions of browsers support the resizeBy() method.
| Chrome | Edge | Firefox | Safari | Opera | IE |
| Supported | Supported | Supported | Supported | Supported | Supported |
Example
Example
Use resizeBy() and resizeTo():
function resizeWinTo() {
myWindow.resizeTo(800, 600);
myWindow.focus();
}
function resizeWinBy() {
myWindow.resizeBy(-100, -50);
}
Try it Yourself »
Window Object Other Extensions