HTML DOM Window moveTo() Method (original) (raw)

Last Updated : 15 Jun, 2023

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

Syntax:

window.moveTo(x, y)

Parameter:

Example: Move the window.

html `

Window moveTo() Method

Geeks for Geeks

Create Move
    <script>
        var myWindow;

        function openWin() {
            myWindow = 
              window.open("",
                          "myWindow",
                          "width=200",
                          "height=100");
          
            myWindow.document.write(
              "

This is 'myWindow'

"); } function moveWin() { myWindow.moveTo(500, 100); myWindow.focus(); }

`

Output:

Initial:

New window:

Move window:

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