title: Why do I need to write alert() after calling window.open()?
body: <p>I have a page <code>index.jsp</code> available at this link <a href="https://www.dropbox.com/s/0smy7nlcmilkqt4/index.jsp" rel="nofollow">https://www.dropbox.com/s/0smy7nlcmilkqt4/index.jsp</a>.</p>
  
  <p>This file contains a JavaScript method named <code>validateloginForm()</code> and is used to validate input fields.</p>
  
  <p>If the fields are filled then it will redirect to another JSP page, but when I remove the <code>alert("after");</code> line below the <code>window.open()</code> line, then it does not redirect to another page.</p>
  
  <p>Please let me know why I need to have this <code>alert("after")</code> after calling <code>window.open()</code>.</p>
  
  <pre><code>function validateloginForm()
  {
      var empId = document.getElementById("empId").value;
      var empPass = document.getElementById("empPass").value;
  
      if( empId == "" )
      {
          alert("Enter id !");
      }
      else if( empPass == "" )
      {
          alert("Enter password !");
      }
      else
      {                 window.open("validateUser.jsp?"+"empId="+empId+"&amp;empPass="+empPass,"_parent","",""); 
           alert("after");   
       }
  }
  </code></pre>