It drives me crazy!
Scenario:
A popup window opens on the main page, and then the function is called:
newWin = window.open(someurl,'newWin',options);
... some code later ...
newWin.remoteFunction(options);
and this is normal.
Now the popup is still open, and the main page changes to page 2. NewWin no longer exists, and I need to recreate the link to the popup window object to call the remote function again (newWin.remoteFunction)
I tried something like:
newWin = open('','newWin', options); if (!newWin || newWin.closed || !newWin.remoteFunction) { newWin = window.open(someurl,'newWin',options); }
And it works, I can call newWin.remoteFunction again. BUT Safari for some reason gives Focus () in the popup every time the open () method is called a navigation violation (I absolutely need a popup that works in the background).
The only workaround I can solve is to create an interval in the popup menu with:
if(window.opener && !window.opener.newWin) window.opener.newWin = self;
and then set another spacing on the opening page with try / catch, but it is inefficient and very inefficient.
so, interestingly, is it really so difficult to get a link to pop-up objects between different pages in a window that opens?
source share