title: Javascript - how to get focus back in opener window
body: <p>My parent window calls a child window and moves focus to it. This works fine. On the child window I want to set focus back to parent window from child window. This works only if I use alert/confirm on parent window. But I don't want my users to click away alert popups all the time. Is there an opportunity to move focus back?</p>
  
  <p>Parent-Window calls child:</p>
  
  <pre><code>function OpenWindow() {
      child = window.open("ZLab/Child", '_blank');
  }
  </code></pre>
  
  <p>Parent-Window sends message and sets focus on child:</p>
  
  <pre><code>function SendMessage() {
      child.postMessage({ param: new Date() }, "/");
      child.focus();
  }
  </code></pre>
  
  <p>Child-Window calls Parent-Window</p>
  
  <pre><code>function OpenParent() {
      opener.GetBack();
  }
  </code></pre>
  
  <p>Parent-Window gets control back. window.focus() doesn't get really focus, just alert/confirm works.</p>
  
  <pre><code>function GetBack() {
      alert("Hi, back again");
      //window.focus();
  }
  </code></pre>