Discussion Locked
0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
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?
1 reply
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
window.close();
}
catch(e) {
window.opener = top;
window.close();
}
Hope this helps.
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending
Discussion Locked
What Makes a Business Website Effective in 2026
2 helpful
10 replies
1 helpful
3 replies
Question
Windows and macOS computers becoming slow or unstable after updates - what should I check first
0 helpful
1 reply
Question Unanswered
Best Way to Make Long WordPress Location Guides Mobile Friendly
0 helpful
0 replies
Discussion
Optimizing WordPress widgets and DOM size
0 helpful
3 replies