title: How to shift focus back to parent window from child window
body: <p>The following is the image of the parent screen:</p>
  
  <p><img src="https://i.stack.imgur.com/uNVcY.png" alt="image"></p>
  
  <p>On click of popup a popup window appears:</p>
  
  <p><img src="https://i.stack.imgur.com/gawhe.png" alt="image"></p>
  
  <p><img src="https://i.stack.imgur.com/5DX9x.png" alt="image"></p>
  
  <p>On click of <strong>create</strong> the alert message appears on the child window.</p>
  
  <p>I tried window.close still the alert message appears on child window then the window gets closed.</p>
  
  <p>Is there any way to make the alert appears on the parent window?</p>
  
  <p>Parent HTML:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;ParentWindow&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;script language="JavaScript"&gt;
    function MM_openBrWindow(theURL,winName,features) { //v2.0
      window.open(theURL,winName,features).focus();
    }
    &lt;/script&gt;
    &lt;form name="frmMain" action="" method="post"&gt;
      &lt;input type="text" name="txtSel" id="txtSel"&gt;
      &lt;input name="btnSelect" type="button" id="btnSelect" value="popup" 
             onClick="javascript:MM_openBrWindow('DrawBinPage.html','pop', 'scrollbars=no,width=350,height=210')"&gt;
    &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
  </code></pre>
  
  <p>Child HTML:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Bin Details Page&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;script src="https://code.jquery.com/jquery-1.11.1.min.js"&gt;&lt;/script&gt;
  
    &lt;script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"&gt;&lt;/script&gt;
                  &lt;/script&gt;             
    &lt;br&gt; &lt;br&gt;
    &amp;ensp;&amp;ensp;Length&amp;ensp;&lt;input type="text" id="GoodsLength" &gt;
    &lt;br&gt; &lt;br&gt;
    &amp;ensp;&amp;ensp;Width &amp;ensp;&lt;input type="text" id="GoodsWidth" &gt;
    &lt;br&gt;&lt;br&gt;
    &amp;ensp;&amp;ensp;Height&amp;ensp;&lt;input type="text" id="Goodsheight"&gt;
  
    &lt;br&gt;&lt;br&gt;
  
    &lt;input name="btnSelect" type="button" id="btnSelect" value="Create" style="width:80px;height:30px" onClick="Createnew()"/&gt; &amp;ensp;&amp;ensp; 
    &lt;input name="btnSelect" type="button" id="btnSelect" value="Close Window" style="width:150px;height:30px" onclick="window.close()" /&gt;
  
  &lt;/body&gt;
  &lt;script&gt;
  function Createnew(){
    alert('hi');
  }
  &lt;/script&gt;
  &lt;/html&gt;
  </code></pre>