Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Need help determining when remote window closes.


  • From: glenn_lanier at netzero.net (Glenn E. Lanier, II)
  • Subject: [Javascript] Need help determining when remote window closes.
  • Date: Wed Jun 22 14:32:48 2005

> From: Andrew Clover mailto:and@xxxxxxxxxxx
> Sent: Wednesday, June 22, 2005 2:19 PM
> 
> Glenn Lanier <glenn_lanier@xxxxxxxxxxx> wrote:
> 
> > when they close the window, I'd like to change the page displayed in
> > the original window. 
> 
> > if (!remoteWin)
> 
> The JS object remoteWin will still exist even if the window 
> is closed, 
> so this test will always be false. Check (remoteWin.closed) instead.

I'm using 

if (remoteWin && remoteWin.closed)
{
	// Window closed
}

I've noticed in testing that if the pop-up is blocked by various pop-up
blockers, remoteWin doesn't exist (actually, it was set to null) and that is ok,
but if I tried to access the closed method and the handle was null, I would get
a Javascript error.

 
> A remoteWin.onunload would be a less ugly way to send the event back 
> than a timeout loop - *if* the document in remoteWin is in the same 
> domain as yours.

It's not. I'll file that away for later use.

 
> > window.open([...], 'toolbar=no, location=no,  menubar=no[...]');
> 
> Don't do that. By removing important system features you've not only 
> made the window annoying to use, but also made the popup 

Yes, I agree. However, contracts signed with company providing site being loaded
in this remote window require the exact window.open command I'm using.

> If your application doesn't need to care about security you'd 
> get away 
> with it, but it's a particularly widespread piece of poor 
> practice that 
> browsers ought really to disallow.

Agreed. Since I use FireFox (with TabBrowser extensions -- not sure which piece
causes the pop-up to open in full window), I get the full window myself, along
with all the menu bars. I don't like when pop-ups load anything less than the
full window (don't mind the sizing, as long as I can resize).

--G

 
___________________________________  
Glenn E. Lanier II
Email: glenn_lanier@xxxxxxxxxxx