Vous êtes sur la page 1sur 2

Alexander Gyoshev

5,550 1 14 37
Sachin
76 1 2 12
4 Answers
TmEllis
I want to close window on logout. I have used
window.close(),
self.close(),
var win = window.open("","_self"); win.close();
window.parent.close();
These all above i have used that all work in IE but in Mozilla Firefox not working.
Please give me solution for that.
Thanks.
javascript
edited Aug 12 '10 at 6:35 asked Aug 12 '10 at 6:24
And why do you want to close my window? Ed S. Aug 12 '10 at 6:36
I have found that Firefox can only use window.close() when script has been called to open that window in the
first place.
Read here for more info.
So if you didn't use a script to open that window, it can't be done.
edited Aug 12 '10 at 8:24 answered Aug 12 '10 at 7:59
I tried to review all topics about window.close() and have found that: IE/Chrome/Safari(?) accept closure if
we open something on _self, so generally
top.open('','_self',''); top.close();
does the work. FF (r 19 when writing this) is more strict about this and somehow forbids any probe like
above. The good answer was found in related thread, that user must manually allow FF to have solution
above working
about.config -> dom.allow_scripts_to_close_windows = true;
I was quite desperated, as Customer requested window closure on
completed operation.
Big bravo to FF dev team. This is exactly how it should work; pity only is that is hard to find it.
Pawel.
answered Feb 22 at 16:58
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no
registration required.
window.close(), self.close() not working on mozilla firefox
WebRep
javascript - window.close(), self.close() not working on mozilla firefox - ... http://stackoverflow.com/questions/3465191/window-close-self-close-no...
1 of 2 4/17/2013 10:16 AM
Pawel.Staszewski.PL
11 1
JB.
183 3 19
nembleton
629 5 10
Ive been using something like this:
<head>
<script language="javascript" >
function ddd() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
window.open('http://www.google.com','mywindow','width=400,height=200');
window.close();
}
</script>
</head>
<body>
<input type= "button" name="new" value="New Window" onClick="ddd()">
</body>
answered Jan 25 '11 at 18:07
Is seems that they are working on Chrome Kiosk ( Fullscreen ) mode. Tried successfully. Up to 19 as of now.
answered Apr 23 '12 at 13:34
Not the answer you're looking for? Browse other questions tagged javascript or ask
your own question.
OVERALL RATING

javascript - window.close(), self.close() not working on mozilla firefox - ... http://stackoverflow.com/questions/3465191/window-close-self-close-no...
2 of 2 4/17/2013 10:16 AM

Vous aimerez peut-être aussi