Skip to content
Related Articles

Related Articles

HTML | Window moveTo() Method

View Discussion
Improve Article
Save Article
  • Difficulty Level : Basic
  • Last Updated : 04 Aug, 2022

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:  

  • Google Chrome 1
  • Mozilla Firefox 1
  • Internet Explorer 4
  • Opera 12.1
  • Safari 1
  • Edge 12

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!