title: How to close the Html window after the form submitted automatically
body: <p>We have two html pages. First Page we are opening the second page using <code>window.open("./pop.html", "",'width=200,height=100');</code></p>
  
  <p>In the <code>pop.html</code> we are submitting the form automatically and we need to close the HTML after submission. The code is given below.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script type="text/javascript"&gt;
  
  function loadForm() {
      var  method = "post"; // Set method to post by default if not specified.
      var path = "http://localhost:8080";
      var form = document.createElement("form");
      form.setAttribute("method", method);
      form.setAttribute("action", path);
  
      var hiddenField = document.createElement("input");
      hiddenField.setAttribute("type", "hidden");
      hiddenField.setAttribute("name", "username");
      hiddenField.setAttribute("value", "sai");
  
      var passField = document.createElement("input");
      passField.setAttribute("type", "hidden");
      passField.setAttribute("name", "password");
      passField.setAttribute("value", "sai123");
  
      form.appendChild(hiddenField);
      form.appendChild(passField);
  
      document.body.appendChild(form);
      form.submit();
  
      window.close(); 
  }
  
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body onload="loadForm();"&gt;
  &lt;form&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>But <code>window.close();</code> not working in page. Is it missing anything?</p>