//Opens a new blank window, writes to it, and then closes it. var newWindow = window.open(); newWindow.document.write("Hello From a New Window"); newWindow.close(); //Opens another URL in a new window window.open("http://google.com");
For example, the
window.open(URL) method opens a new window and returns a new window object. If you do not specify a URL, the browser opens a blank page that can be written to using the
You can call
.close() on window objects that you have created, and they will be closed.