English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Window resizeTo() method

JavaScript Window Object

resizeTo()The method adjusts the window size to the specified width and height.

Syntax:

window.resizeTo(width, height)
// Function to open a new window
function windowOpen() {
  popupWindow = window.open("", "", "width=",150, height=150");
}
// Adjust the function of opening window size
function windowResize() {
  popupWindow.resizeTo(500, 500);
  popupWindow.focus();
}
Test and See‹/›

Browser Compatibility

All browsers fully support the resizeTo() method:

Method
resizeTo()YesYesYesYesYes

Parameter Value

ParameterDescription
widthSet the width of the window (in pixels)
heightSet the height of the window in pixels

Technical Details

Return Value:None

More Examples

This example combines resizeBy() with resizeTo():

function windowResizeTo() {
  popupWindow.resizeTo(500, 500);
  popupWindow.focus();
}
function windowResizeBy() {
  popupWindow.resizeBy(100, 100);
  popupWindow.focus();
}
Test and See‹/›

Related References

Window (Window) Reference:resizeBy() Method

Window (Window) Reference:moveTo() Method

Window (Window) Reference:moveBy() Method

JavaScript Window Object