Forum Home
Press F1
 
Thread ID: 48057 2004-08-13 00:24:00 FireFox doesn't close window tbacon_nz (865) Press F1
Post ID Timestamp Content User
261099 2004-08-13 00:24:00 On my XP home PC, Firefox doesn't respond to a "close window" link. The javascripit is either javascript.window.close or javascript.close (neither seem to work).

I have javascript enabled and all the advanced options ticked.

Any ideas? This is not a big deal for me, I'd just like to know!

Tony Bacon
tbacon_nz (865)
261100 2004-08-13 01:38:00 Do you get a error message?. go to tools and click on javascript's console and then try to close the window and see what or if you get a error message
try these key board shortcuts to Close Window Ctrl+Shift+W or Alt+F4
hths
johnboy (217)
261101 2004-08-13 04:18:00 Veeery interesting - but shtoopid.

The javascript console in Firefox gives me the message "Scripts may not close windows that were not opened by script." So what I think is happening (at least in this case) is that my shortcut takes me directly to a webpage, and the close link is presumably regarded as being part of a script and so won't do it. This is confirmed by the fact that if I reach the page the "long" way i.e. by linkiing from its menu page, the close does work.

IE6 just tells me the browser is trying to close the page and is this OK - in both instances. I'm guessing this is one of those cases where Firefox is following a standard and IE6 is doing its own merry thing - or is it a case of different javascript implementations?
tbacon_nz (865)
261102 2004-08-13 04:26:00 This is probably an inevitable result of the security built into Java.

Presumably, when you reach the page the long way, various environment variables have been set up in your interpreter. When you go in with the shortcut, the interpreter sees code which isn't "owned", in a properly set up "sandbox" so it says "Oi, you can't do that there 'ere".

(The "sandbox" is a place where code can play safely, without causing security problems outside the sandbox. )
Graham L (2)
261103 2005-05-05 17:07:00 in IE u can get around that by doing
window.opener=self; window.close();
but firefox doesn't allow even that...
t0rus (6021)
261104 2005-06-27 20:17:00 just a note how to get around it - use frames - create a 0px width frame and load your page in the other frame, when u need to close it just use something like parent.frame1.window.close();
or use this way - in the main page (where the window is opened from) create a function,
closeMyWindow(){
wnd.close();
}
and when u opening a new window, do something like this
window.open('wnd','page.html');
and in that window you can call parent.closeMyWindow();
t0rus (6021)
261105 2006-02-10 05:43:00 Actually it is possible to use window.close() in FireFox... I was asked to do it at work the other day and came up with a pretty simple solution.

Read the full story of how I solved this problem here:
www.interwebby.com
interwebby (6022)
1