[thelist] Popup and opener interaction

kasimir-k kasimir.k.lists at gmail.com
Sat Feb 3 12:23:08 CST 2007


> Kasimir-k wrote:
>> I had a bit similar situation and ended up not calling the pop-up from 
>> our server, but using document.write in the script the clients include 
>> on their pages. This way the pop-up can communicate to the opener.
>>   

Rick den Haan scribeva in 02/02/2007 22:54:
> I hadn't considered that one yet. But now that I have, the javascript is 
> already growing rather large. I'd rather not put all the functions 
> necessary for the actual chatsessions and all the output to fill the 
> popup in the customer's site as well, because that would significantly 
> increase the size of the JS file.

But it wouldn't increase the total size, as you wouldn't need to
download the pop-up's html anymore. And the JS file should be cached anyway.

> But, although this would solve my particular problem for this current 
> project, it doesn't answer the fundamental question. Is it possible to 
> retrieve a child window, if the opener no longer knows about it? It 
> might be possible to try to window.open() a javascript url into a popup 
> with the same name. In my case:
> 
> At first:
> window.open(sComUrl, 'SupportCommunication', sComProps);
> 
> Then, after the opener has lost it:
> window.open('javascript:if (typeof someVariable == "undefined") { 
> opener.oCommunication = null; self.close(); } else { 
> opener.oCommunication = self; }', 'SupportCommunication', sComProps);
> 
> Where someVariable would be something that's supposed to be in the popup 
> window. Or, come to think of it,  "if (history.length > 0)" might work.

What I think would happen there is that a new pop-up would open. But me
too too lazy to test :-)

> This is just brainstorming a bit here, I'm too lazy to actually work on 
> it right at the moment, but what do you think?

I think that if the opener window's content changes (e.g. users browser
to other pages) then any connection from the opener to the pop-up is
lost, so that the only way is the other way round: the pop-up calls a
function in the opener. And that won't work, if they are from different
domain.

Or then the AJAX route, both opener and pop-up talking with the server.

.k




More information about the thelist mailing list