File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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
Author

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 window.open) 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
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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.

Eric
Sean Clark
Rancher

Joined: Jul 15, 2009
Posts: 377

Hey,

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.

Sean


I love this place!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Firefox 3.5 Browser window close using javascript
 
Similar Threads
Populating fields on a webpage based on the remote webpage data
how to exit from a page
Getting parameters from a pop-up window
Refershing the parent page from the second child
Close Popup Window after download completes