Nudge a popup with Up / Down / Left / Right buttons.
JavaScript
// After opening a popup named `popup`:
popup.moveBy(0, -15); // up
popup.moveBy(0, 15); // down
popup.moveBy(-15, 0); // left
popup.moveBy(15, 0); // right
Map buttons. Each UI control chooses its (dx, dy).
Keep a reference. Call methods on the popup object.
Teaching tip. Great way to feel relative movement.
Compatibility
Browser Support
Window.moveBy() is marked Baseline Widely available on MDN (since July 2015). Browser Window API — not a Node.js built-in. Actual movement still depends on popup / OS policy.
✓ Baseline · Widely available
moveBy()
Relative window moves across modern browsers (with UX restrictions).
99%Core tag support
ChromeYes
Full support
EdgeYes
Full support
FirefoxYes
Full support*
SafariYes
Full support
OperaYes
Full support
HTML element100% supported
Bottom line: API is universal; prefer script-opened popups. Do not build layout on moveBy().
Frequently Asked Questions
It moves the current window by a relative pixel offset. deltaX is horizontal (positive = right, negative = left). deltaY is vertical (positive = down, negative = up).
moveBy(dx, dy) shifts from the current position. moveTo(x, y) jumps to absolute screen coordinates.
No. Browsers often block moving tabs the user opened directly, or windows with multiple tabs. It works more reliably on popups created with window.open().
No. It returns undefined. Read screenX / screenY if you need the current position.
Not necessarily. MDN notes it might not move the window synchronously, and on some environments (for example Wayland or mobile) it may not move at all.
No. MDN marks Window.moveBy() as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard — but browser UX restrictions still apply.