views:

134

answers:

2

i'm using simple close browser javascript statement winodw.close(); but it doesn't work with any browser except IE. any help to close browser firefox or opera or chrome. thanks

+8  A: 

you can't close a window with javascript that you didn't open by javascript. Browsers correctly interpret this as behavior their users probably don't want. And the user is the browser's customer, not you, so what they want is what the browser will do.

Brian Schroth
+2  A: 

Javascript can only close a window that it opened, so unless you pop up a new window with js, you aren't going to be able to close it. Which is obviously a good thing.

Bryan Rowe
so i can't close firefox browser by any way ???
Amr Elnashar
No. Would you want random websites closing your browsing session?
ceejayoz
yes i need to close the window any way
Amr Elnashar
@AmRoSH, so far people are telling you "you can't do that" because in general, visiting a site that closes your windows is something that annoys people. Perhaps if you explain at a higher level what it is that you're trying to do people can help you better. (Unless you WANT to annoy people, in which case people likely WON'T help you.)
Berry
Can I turn off your computer via JavaScript since I want to save the Earth from greenhouse gases? Sorry! My browser history is mine, window size is mine, my right click is mine! You can not get around these restrictions. You need to tackle the real issue here and it probably deals with back button after log off or hiding toolbars. Nothing like washing a window with a hammer.
epascarello