The Uncanny Disappearing Window
How do you programmatically close a browser window when you didn't open it? Of course, everybody knows you can't. If they don't know that, they're novice developers and some seasoned veteran will set them straight... gently or otherwise.
Well, this week one of my clients -- whose intranet app opens in a specially formatted window -- told me they didn't want two windows just to start one application. I had very little success removing the toolbars from an existing window, and my vast web development experience told me that I had no other option. Rather, I didn't until a suggestion from a fellow member of the LaTech JavaScript list altered my perspective and resulted in the script I'm about to show you.
All you need to start the magic is to assign a window to the opener property of the current window. If this attribute is not set, the browser will realize that the current window is not open to your manipulation and nothing will happen.
<SCRIPT
LANGUAGE="JavaScript">
window.opener =
top;
</SCRIPT>