View Full Version : redraw parent after object move & before popup

06-01-2003, 11:36 PM
Because of (potentially) long delays in opening a named browser window (i.e. when it's a new window with several already open), I am flashing a small "Please Wait..." over the link text.

My problem is that the parent window becomes very busy looking for the named window and does not actually draw the "Please Wait..." until after the new window is already created. :mad:

A synchronous wait (sleep? pause?) might work here, but such is not available (and busy wait loop is offensive to my sensibilities).

SO! My thoughts turned to possibly triggering a "redraw" of the parent window before calling window.open() .

As of this writing, the only solution that comes to mind is to break the popup / focus function into parts and use setTimeout() for the delayed section so the "Please Wait..." has time to be displayed (which, of course, will be un-displayed later via a separate setTimeout() call). Needless to say... YUCK!


PS: Another approach that comes to mind as I close this post: is there a fast way to determine if a particular named window is extant? This would need to be done without creating such a window in the process (thus window.open() is not a candidate).

06-02-2003, 12:38 AM
While awaiting help, I tried the busy loop strategy, but that doesn't do what I want (it merely adds more delay :eek: ).

06-02-2003, 04:33 AM

<script language="javascript">
function doOpen(url,target){

//to ensure no global variable conflict with other script
var strWinHandle = target + "_objDocWin";

//just focus to the corresponding window if it is already open
if (window[strWinHandle] && !window[strWinHandle].closed){
return false;

window[strWinHandle] = window.open(url,target,'menubar=0,location=0,toolbar=0,resizable=1,status=0');
return false;
<a href="test.htm" target="testpage" onclick="return doOpen(this.href,this.target)">Open</a><br>
<input type="button" value="Open2" onclick="doOpen('test2.htm','testpage2')"><br>