...

View Full Version : close a window knowing only its name



wac
12-07-2004, 07:37 PM
How does one close a window in javascript if all you know is the name of the window?

kansel
12-07-2004, 09:00 PM
If you know the name of the window (as set in a window.open() command or with window.name='something'), but do not have a pointer to the window itself, you can recreate the pointer by re-opening the window, then close it with the new pointer. The downside to this approach is that if the window is not open in the first place, a new window will be opened and immediately closed.

var w = window.open('',windowName);
w.close();



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum