In javascript, the window.open function takes as a second argument the name of a window. I am trying to open Google in a new named window with
window.open('http://google.com/', 'myGoogleWindow');
but nothing happens. However,
window.open('http://google.com/');
works. However, I want to name the window since I would like to programmatically close it later. How do I open a popup in a named window?
Specifying the window name is unnecessary if all you want to do is close the window later on. The window name exists so that you can reuse the window if it was already opened, and so that links with a matching
targetattribute will load in your window.Referring to Mozilla’s window.open() documentation, the window.open() function returns a window object reference. Using that reference, you can close the window when you’re done with it: