Firefox 2.0: closing a window

A

Andre

With Firefox 1.5+, I used the following code to close a window/tab:
===
<html><head>
<script language="javascript" type="text/javascript">
function closeWindow() {
window.open('','_parent','');
window.close();
}
closeWindow();
</script></head><body></body></html>
===
Since I upgraded to Firefox 2.0, it does not work - the window/tab
stays open.

Any idea how I can "load a page" that would force a window/tab close?

André
 
A

Andre

Randy said:
Andre said the following on 10/26/2006 6:50 PM:

The fact that it even works in FF is amazing.



That is a good thing. It means script cant close a window/tab it didn't
open.


I hope not.

I understand why this would normally not be something desirable
(loading a page just to see the browser close...), however I found it
useful for my purpose.

Here's the context:

I wrote an web-app (crunchy.sf.net; python-based with some sprinkle of
javascript) that uses Firefox as its GUI: upon starting the app, it
open a new firefox window or, if one was already open, would open a new
tab. I have a menu with a "quit button" which closes the app (python
back-end) and used to close the Firefox window/tab that was open.
P.S. That code doesn't open a window for me in IE nor FF.

Here's a confirmation that it does (did) work for some people:
http://www.interwebby.com/blog/2006/02/04/3/

(It was not the original place I found this "trick", but is one
example...)

André
 
R

Randy Webb

Andre said the following on 10/26/2006 6:50 PM:
With Firefox 1.5+, I used the following code to close a window/tab:

The fact that it even works in FF is amazing.

Since I upgraded to Firefox 2.0, it does not work - the window/tab
stays open.

That is a good thing. It means script cant close a window/tab it didn't
open.
Any idea how I can "load a page" that would force a window/tab close?

I hope not.

P.S. That code doesn't open a window for me in IE nor FF.
 
R

Randy Webb

Andre said the following on 10/26/2006 7:09 PM:
I understand why this would normally not be something desirable
(loading a page just to see the browser close...), however I found it
useful for my purpose.

It's a security flaw, it has no useful purpose.
Here's the context:

I wrote an web-app (crunchy.sf.net; python-based with some sprinkle of
javascript) that uses Firefox as its GUI: upon starting the app, it
open a new firefox window or, if one was already open, would open a new
tab. I have a menu with a "quit button" which closes the app (python
back-end) and used to close the Firefox window/tab that was open.

Flip them back to the front page of the app.
Here's a confirmation that it does (did) work for some people:
http://www.interwebby.com/blog/2006/02/04/3/

(It was not the original place I found this "trick", but is one
example...)

I never said it didn't work for some people. Short of a video of it
happening (which I won't do), I can only tell you - without doubt - that
it does NOT open a new window/tab for me in IE7, FF 1.5.0.7 nor in Opera 9.

The only thing it does do is close the active tab/window.
 
R

Randy Webb

Randy Webb said the following on 10/27/2006 7:52 AM:
Andre said the following on 10/26/2006 7:09 PM:

Firefox 2.0 gives the very accurate error message:

Scripts may not close windows that were not opened by script.

Why FF1.5 didn't is up for speculation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,817
Latest member
AdalbertoT

Latest Threads

Top