This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Firefox 3.5 Browser window close using javascript  RSS feed

 
Venkata Sirish
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!