Re: <body onload="self.close();"> won't work on Firefox 1.0.7?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

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

From: RobG <rgqld@iinet.net.au>
Date: Fri Jan 20 2006 - 02:25:20 CET

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
Received on Tue Feb 7 21:14:42 2006