File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Firefox 3.5 Browser window close using javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Firefox 3.5 Browser window close using javascript" Watch "Firefox 3.5 Browser window close using javascript" New topic

Firefox 3.5 Browser window close using javascript

Venkata Sirish
Ranch Hand

Joined: Apr 09, 2007
Posts: 112
Hello ranchers,

Iam developing a web application using J2EE, Javascript technologies. In my application i have a signout button in every page to allow user to signOff from the application including closing the browser window.

I used the following code to close the browser window, below code works fine in IE7+ but unfortunately does not work in Firefox 3.5.

After goggling i realized that, in Firefox, browser windows opened only through javascript (using can be closed pro-grammatically. So i found that below code is a solution for this. But above code doesn't work from firefox 3.5. Any alternate solution for this ?

Any help is really appreciated. Thanks in advance for your time and attention.
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
If you did not open the window, you should not be allowed to close it.

What you are trying to exploit is bugs in the browser, and hopefully the bugs have been patched, hence why it does not work.

Sean Clark

Joined: Jul 15, 2009
Posts: 377


Your answer is here stack overflow question, it works but as you will still see you get a security warning from Firefox before it continues with the operation.

I agree with what Eric says though, you should not be doing this.


I love this place!
I agree. Here's the link:
subject: Firefox 3.5 Browser window close using javascript
It's not a secret anymore!