Problem: It is necessary to get the handle of the already opened javascript popup (handle = window.open (...)) from its open window, a few requests later after the window of its opener (parent) has been updated and the javascript variables reset.
For example, a parent window may have javascript as follows:
<script type="text/javascript"> var popupHandle; function openPopUp() { popupHandle=window.open('http://www.google.ca', 'popupTest'); popupHandle.focus(); return popupHandle; } // To get handle, need to reopen popup with same name as original (popupTest). function getPopUpHandle() { return openPopUp(); } // If getting handle to close, open as small as possible and close so it's not too noticeable. function closePopUp() { popupHandle=window.open('', 'popupTest', 'directories=no,location=no,menubar=no,status=no,resizable=no,scrollbars=no,titlebar=no,top=1,left=1,width=1,height=1'); popupHandle.close(); } </script>
If you know a better solution, let me know.
How I use it in my application: I have a list of images displayed on one side of the screen. On the other hand, I have a form that allows me to send information based on the image. When the form is submitted, it attaches the referenced image.
Clicking on the image opens a popup window.
When the form is submitted, the next image in the list should open in a pop-up window. The popup could be closed by the user.
source share