473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Firefox 2.0: closing a window

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é

Oct 26 '06 #1
4 10297
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.

<snip>
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.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Oct 26 '06 #2

Randy Webb wrote:
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.

<snip>
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.
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é

--
Randy
Oct 26 '06 #3
Andre said the following on 10/26/2006 7:09 PM:
Randy Webb wrote:
>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.

<snip>
>>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.

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.
>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...)
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.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Oct 26 '06 #4
Randy Webb said the following on 10/27/2006 7:52 AM:
Andre said the following on 10/26/2006 7:09 PM:
>Randy Webb wrote:
>>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:
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.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Oct 26 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: M.D. | last post by:
Hi, I am having a problem with my program which only happens when using Mozilla or Firefox. The pages I wrote, are part of a private web directory, a service offered by the ISP, which upon...
5
by: GEL | last post by:
Hi, I want to open a new browser window, let the user use that window for several minutes, and when they close, I'd like to change the page displayed in the original window. According to...
4
by: stevong | last post by:
It works on Konquerer though. I remember it works on IE too. I've tried window.close() too. Doesn't work on Firefox also. I've also tried to create a function. It doesnt work on Firefox also....
11
by: Alex.Svetos | last post by:
Hello, I'm trying to get a popup to keep focus when it is re-clicked. The script below is supposed to produce this exact behaviour, however it doesn't work, at least on firefox 1.0.7 and moz...
1
by: nebulus | last post by:
I'm working on a web app that under normal circumstances will be happy with the Session_OnEnd event, but when a user leaves a page by closing the browser by either Alt+F4 or just hitting the "X",...
10
by: Tony | last post by:
I need to know how to open a pop up and close the main window without a prompt in Firefox 2 and IE 7. Anybody have any ideas on how to do that. I currently have this and it works in IE 6 and...
3
by: rsilvergun | last post by:
Hi all, I'm trying to use Firefox to as an html renderer for reports. All I really want it to do is display a print dialog so I can select the printer I want to print to, and then print the HTML. I...
29
Frinavale
by: Frinavale | last post by:
I have 2 FireFox (version 2) browser windows opened. One is the child of the other. When the user is finished with the child window, a method in the parent window is called to refresh a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.