Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detecting another window
Message
From
03/02/2003 04:54:29
 
 
To
02/02/2003 02:54:15
General information
Forum:
Internet
Category:
Javascript
Miscellaneous
Thread ID:
00748108
Message ID:
00748302
Views:
16
>This seems to be a very complicated issue and I was not able to find something to achieve that. One page is loaded with a script in reference to window.name='MyName'. So, this gives a name to the current page. However, from another instance of IE, I need to detect if another IE window is loaded under the name MyName. Anyone succeeded in doing that?
>
>Remember, this is not one window creating another window. We do not have any object reference from one to another. We need to lookup the hierarchy and detect for a specific window name. So far, I am able to target to the MyName window as soon as I defined the window.name='MyName'. However, I need to get a handle on that object. So, first, I need to detect if a specific IE window is having the MyName as the window name. Then, I need to issue a javascript command that will load a specific URL in that window.

This may not be ideal (opens a new window & closes it, if required window not already open), but it may do what you require - basically try opening a window with the required name & check the contents of that window, if blank close the window, otherwise load your URL :-
var TargetWin = null ;
TargetWin = window.open( '', 'MyName', 'left=2000' )
if ( TargetWin.document.location == 'about:blank' )
 {
 TargetWin.close() ;
 TargetWin = null ;
 }
else
 {
 TargetWin.navigate( 'YourURL' )
 }
You may need to alter the 3rd parameter of the open method to ensure that the empty window is opened off screen to avoid the window flashing on & off.
Len Speed
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform