Web Development

General discussion


Closing first browser window

By kunta ·
When I load my first ASP.NET application page in the browser, I want to transform the browser window by removing toolbar, menus and status bar. As I can't do that, I open another window without these controls, but then I cannot close the first window without the messagebox which warns the user that the window will be closed. Is there any possibility to close the first window without the messagebox, or to "clean up" the first window while loading ASP.NET page?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Browser weirdness

by Ed Woychowsky In reply to Closing first browser win ...

In the early days of the internet this was one of the practical jokes. Simply coding window.close() in client-side JavaScript was enough. People quickly got upset so future browser releases wouldn’t permit it for the parent window.

I’ll probably be flamed for this but, notice that I said “parent window”, the trick is to make the browser think that the parent window isn’t the parent window.

// Open window here

try {
x = window.opener.location; // Error, if not a child window
catch(e) {
window.opener = top;

Hope this helps.

Related Discussions

Related Forums