| Author |
Close Pop up window in Forefox 4.0 using java script.
|
kartik reddy
Greenhorn
Joined: Dec 11, 2008
Posts: 9
|
|
Hi does anyone have a code to close the browser window using Firefox 4.0?
This code needs to be used to close a pop-up window.
When I open a window and try to press the button to close it, it doesn't work in Firefox 4.0.
Code is: javascript:window.close();
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15361
|
|
Did you open it up with window.open?
Eric
|
 |
kartik reddy
Greenhorn
Joined: Dec 11, 2008
Posts: 9
|
|
Hi Eric,
It works fine when I use with window.open
i.e., When I open a window using window.open() and try to press the button to close it using javascript:window.close(), it works fine.
But the most interesting thing is when I don’t use window.open() and try to close the current window it doesn’t work.
Could you please give any suggestion, how to proceed further?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56521
|
|
|
If you didn't open the window, you can't close it.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
kartik reddy
Greenhorn
Joined: Dec 11, 2008
Posts: 9
|
|
|
Ok, is there any alternate solution for that?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56521
|
|
|
No. It is a security restriction.
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15361
|
|
Older versions of browsers have hacks to close the window, but that is coding against a browser flaw. It is talked about a lot here in the past. Modern day browsers have the flaw patched in most cases.
Eric
|
 |
kartik reddy
Greenhorn
Joined: Dec 11, 2008
Posts: 9
|
|
Thanks a lot for giving inputs on this issue.
- Kartik
|
 |
 |
|
|
subject: Close Pop up window in Forefox 4.0 using java script.
|
|
|