Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jun 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question redraw parent after object move & before popup

    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.

    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!


    TIA!

    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).

  • #2
    New to the CF scene
    Join Date
    Jun 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy busy loop doesn't work for this

    While awaiting help, I tried the busy loop strategy, but that doesn't do what I want (it merely adds more delay ).

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts

    checking if window is already opened

    try:

    Code:
    <html>
    <head>
    <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){
    		window[strWinHandle].focus();
    		return false;
    	}
    
    	window[strWinHandle] = window.open(url,target,'menubar=0,location=0,toolbar=0,resizable=1,status=0');
    	window[strWinHandle].focus();
    	return false;
    }
    </script>
    </head>
    <body>
    <form>
    <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>
    </form>
    </body>
    </html>
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •