How Do You Close the Current Window Using Javascript?


Quick Answer

To close a window using JavaScript, implement the window.close() procedure. The window.close() procedure works in conjunction with the window.open() procedure and allows the user to exit a selected window.

Continue Reading
Related Videos

Full Answer

Use the following instructions to close an open window.

  1. Open the JavaScript
  2. Open the JavaScript programming page.

  3. Input the window.open command
  4. Type in the window.open command and input the name of the selection source.

  5. Input the window.close command
  6. Type in the window.close command to exit the chosen the window.

How these commands work depends on the platform the script is on. Mozilla Firefox, for example, will only allow window.close scripts if the procedure has called them to open.

Learn more about Computer Programming

Related Questions