Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q874 How can I get the window handle of an already opened window?

irt.org | Knowledge Base | JavaScript | Window | Q874 [ previous next ]

Q874 How can I get the window handle of an already opened window?

Unless you store the window handle at the time you create the window then you can use the solution described in FAQ 782.

You can store a window handle using:

<script language="JavaScript"><!--
windowHandle = window.open('http://www.irt.org','windowName','height=640,width=480');
//--></script>

If you replace the document in the window that opens the popup window then the windowHandle variable is lost. If you need to maintain the window handle then you could consider using a frameset within the main window that uses a hidden frame - so as to make the window look as though its not using frames - and store the window handle in the parent frame:

<script language="JavaScript"><!--
parent.windowHandle = window.open('http://www.irt.org','windowName','height=640,width=480');
//--></script>

This windowHandle variable will then persist, even if the current documents location is changed - but not if the parent frames location is changed.

Feedback on 'Q874 How can I get the window handle of an already opened window?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.