473,324 Members | 2,002 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,324 software developers and data experts.

<body onload="self.close();"> won't work on Firefox 1.0.7?

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.
Bottomline is: Firefox doesn't accept window.close() or self.close()?

Are there ways to rectify the issue?

Please advise.
Thanks

Steven.

Jan 19 '06 #1
4 14411


stevong wrote:
I've also tried to create a function. It doesnt work on Firefox also.
Bottomline is: Firefox doesn't accept window.close() or self.close()?


It depends on the browser settings whether script is allowed to do
certain things like closing windows. Usually script can only close a
window that has been opened by script (window.open) but Mozilla probably
can be configured to completely disallow script to close windows.

Firefox 1.5 gives a message
"Scripts may not close windows that were not opened by script."
in the JavaScript console if window.close() fails on a window that has
not been opened by script. I think Firefox 1.0.x does the same but can't
check currently.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 19 '06 #2
Martin Honnen wrote:


stevong wrote:
I've also tried to create a function. It doesnt work on Firefox also.
Bottomline is: Firefox doesn't accept window.close() or self.close()?

It depends on the browser settings whether script is allowed to do
certain things like closing windows. Usually script can only close a
window that has been opened by script (window.open) but Mozilla probably
can be configured to completely disallow script to close windows.


I tried in Firefox 1.5 to modify the dom.popup_allowed_events entry to
allow close, but it didn't work.

The rule seems to be that only a script in the opener page can close a
popup without user action. The OP could put a close function in the
parent and call that from the popup's load event.
In the opener:

var popA;
function openWin(){ popA = window.open('x.html','PopA',''); }
function closeMe(x){ if (x.close) x.close(); }
In the popup:

<body onload="opener.closeMe(this);">
But what is the point of having a window close itself onload?

[...]
--
Rob
Jan 20 '06 #3
RobG said the following on 1/19/2006 8:25 PM:
Martin Honnen wrote:


stevong wrote:
I've also tried to create a function. It doesnt work on Firefox also.
Bottomline is: Firefox doesn't accept window.close() or self.close()?

It depends on the browser settings whether script is allowed to do
certain things like closing windows. Usually script can only close a
window that has been opened by script (window.open) but Mozilla
probably can be configured to completely disallow script to close
windows.


I tried in Firefox 1.5 to modify the dom.popup_allowed_events entry to
allow close, but it didn't work.

The rule seems to be that only a script in the opener page can close a
popup without user action. The OP could put a close function in the
parent and call that from the popup's load event.
In the opener:

var popA;
function openWin(){ popA = window.open('x.html','PopA',''); }
function closeMe(x){ if (x.close) x.close(); }
In the popup:

<body onload="opener.closeMe(this);">
But what is the point of having a window close itself onload?


The way I read the OP was that they wanted to close the original window.

Page1 is loading.
Page1 opens a new window sans features.
Page1 finishes loading.

(Thats my hypothetical scenario to attempt to understand what they
wanted to do)

OP wanted to close Page1 was the way I read it. And no Gecko based
browsers allow it.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 20 '06 #4
No idea why you'd want to do this onload.

Contrary to popular belief it is possible to use window.close() in FireFox though... 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:
http://www.interwebby.com/blog/2006/02/04/3/
Feb 10 '06 #5

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

Similar topics

3
by: Oliver Spiesshofer | last post by:
Hi, I have a script that calls an fopen() on an external URL. I can run the script from the server as an url fine. When however the script should be run from crontab, it does not work. I get ...
5
by: Catherine | last post by:
I am having a problem viewing asp pages on iis version 5.1 xp pro. HTML pages are viewable on http://localhost but .asp pages are not. I have created a test program called timetest.asp with the...
19
by: Allen Thompson | last post by:
sorry for the simple question, haven't done this in a while. when I use the following script it keeps displaying the value of "x" like a string. for example, if I type the number 7 in the prompt,...
0
by: Sebastian Sosna | last post by:
Hi there! iam trying a code snippet from MSDN heres the link : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netdir/netds/creating_groups.asp ive tried the code but it...
7
by: Christine | last post by:
My code has a split function that should split the text file of numbers. I've run this in previous programs as it is here and it worked, but now it wont work for some reason and returns...
1
by: Gary | last post by:
I have the following in my web.config.... <customErrors mode="RemoteOnly" defaultRedirect="Applicationerror.aspx"/> but, my error page does not display. Instead a 'Runtime Error' page...
14
by: squash | last post by:
The following code works fine in Firefox/Netscape but wont work in IE. I suspect the problem is with one of these two simple functions. If there is no obvious error Ill paste the entire code. ...
8
by: Mark12345 | last post by:
Hi folks, thanks for looking. I have a database that takes down order details. Each customer has there own priceid in the price table. the errors that I get say enter parameter value for:...
2
by: jcollins1991 | last post by:
im trying to make a program thats supposed to check whether 2 strings are anagrams of each other (anagram = same letters in both strings, but in different orders... "cool as wet art" , and "cs at...
2
darksteel21
by: darksteel21 | last post by:
is there any one can help me....i have a problem in displaying showmodal dialog box in mozilla firefox browsers...showmodal dialog box wont work on firefox browsers but on IE it works fine..can...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.