Skip to content
Related Articles

Related Articles

HTML | Window moveTo() Method
  • Difficulty Level : Basic
  • Last Updated : 26 Jul, 2019

The moveTo() method is used in the window to moves the window from the left and top coordinates.


window.moveTo(x, y)


  • x: A positive or negative number that specifies the horizontal coordinate to be moved to
  • y: A positive or negative number specifies the vertical coordinate to be moved to

Example: Move the window.

<!DOCTYPE html>
      Window moveTo() Method
        h1 {
            color: green;
        <h1>Geeks for Geeks</h1>
        <button onclick="openWin()">
        <button onclick="moveWin()">
            var myWindow;
            function openWin() {
                myWindow = 
                  "<p>This is 'myWindow'</p>");
            function moveWin() {
                myWindow.moveTo(500, 100);


New window:

Move window:

Supported Browsers: The browser supported by Window moveTo() Method are listed below:

  • Goole Chrome
  • Mozilla Firefox
  • Opera
  • Safari
  • Edge

My Personal Notes arrow_drop_up
Recommended Articles
Page :