• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 145
  • Last Modified:

Background Window dissappearing

Hello,

I am working on some javascript code for a help button that open a help popup window.
Sample code as follows:

var HelpWindow = window.open( ...);
window.focus(this)

This code opens a Help popup window in the foreground when the Help button from the parent window is pressed. The problem that I have, is when I close the Help popup Window, the parent Window dissapears. I have to click on the screen with the mouse pointer and the background Window re-appears.

I have been reading that I might need to add some kind of recursive timer to check if the Help popup window is Closed HelpWindow.closed or something to reset the focus(). Or maybe reset the focus like

opener.focus(this);

Not sure how to resolve this issue ?
Has anyone ran into this problem ?
Suggestions ?

Paolo
0
ptreves
Asked:
ptreves
  • 4
1 Solution
 
CKY092Commented:
Do you have a link to the site? Or some sample code?
0
 
ptrevesAuthor Commented:
Here is the javascript function:

/**
 * Shows the current {@link #helpUrl} in a new window.
 */
function showHelp() {
    var fullHelpURL = "$helpDirectory" + helpUrl;

    helpWindow = window.open(fullHelpURL, 'Help', 'width=650,height=500,
                                                   toolbar=no,resizable=yes,scrollbars=yes');
    helpWindow.focus(this);
    var timer = setInterval(function() {    
       if(helpWindow.closed) {  
         clearInterval(timer);
         helpWindow.blur();
         helpWindow.back();
         opener.focus(this);  
       }  
    }, 200);
}

In the timer loop, I am thicking of either one of the following statements:
         helpWindow.blur();
         helpWindow.back();
         opener.focus(this);  

Suggestions?

Paolo
0
 
ptrevesAuthor Commented:
How can I reset the focus to the parent Window when I close the popup ?
0
 
ptrevesAuthor Commented:
Can you show me some sample code to do that ?

Paolo
0
 
ptrevesAuthor Commented:
solved problem
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now