title: Close windows that were not opened by script using javascript
body: <p>I want my web application to run in a window which has no menubar, addressbar etc. I have a Default.html page and in this page I click a "Run Application" button which first opens my application in another window using <code>window.open</code> and then closes the current window by opening "AutoClose.html" using <code>window.open</code> with <code>_self</code> parameter</p>
  
  <p>Default.html</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script type="text/javascript"&gt;
      function runApp() {
          // Open my application
          window.open('Application.html', null, 'status:no;dialogHide:true;help:no;scroll:yes;center=yes;');
  
          // Close this window
          window.open('AutoClose.html', '_self');
      }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;input type="button" value="Run Application" onclick="runApp();" /&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>AutoClose.html</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script type="text/javascript"&gt;
      window.close();
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;&lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My application should support IE, Firefox and Chrome and my code works fine on IE and Chrome but it is unable to close the first window on Firefox because of "Scripts may not close windows that were not opened by script" warning. On Firefox it opens the AutoClose.html but <code>window.close()</code> call in this page just causes the "Scripts may not close windows that were not opened by script" warning and window is not closed. By the way my application window is opened without any issues (no problem about that).</p>
  
  <p>It seems that using <code>window.open()</code> with <code>_self</code> parameter trick does not work for Firefox. Since my goal is to run the application in a window without menubar, addressbar etc. </p>
  
  <ol>
  <li>Is there any way for hiding addressbar, menubar without using <code>window.open()</code> (at least for Firefox)? Then I will not need to run <code>window.close()</code> </li>
  <li>Is there any setting to suppress "Scripts may not close windows that were not opened by script" warning on Firefox? An "Allow scripts to close windows that were not opened by script" setting would be great (:</li>
  <li>Is there any way to make <code>window.close()</code> work for "windows that were not opened by script using javascript" on Firefox?</li>
  <li>Or, is there any other suggestions (:</li>
  </ol>
  
  <p>Thanks in advance.</p>
  
  <p>UPDATE: This is a banking application and I am just a developer not the decision maker. In other words some kind of analyst wants the application work in this way. And I am not questioning it. So "the whole thing you are trying to do is completely wrong" answers will not be really helpful.</p>