title: Script to close other tabs or browser
body: <p>In my MVC application being developed for sales, I have a button which opens a web page which doesn't allow iframe to open in a new tab. So, when the sales agent use this button, they often don't close the tabs opened by the application and in the end of the day, there is 20-30 of open tabs. So, I was wondering if there is a script which I can add to a new button which could close:</p>
  <ol>
  <li>Either the complete browser with all tabs in it so they can start fresh or</li>
  <li>Close all other tabs without affecting the current tab.</li>
  </ol>
  <p>In the view, I have</p>
  <h3>HTML</h3>
  <pre><code>&lt;input type=&quot;submit&quot; onclick=&quot;return OpenInNewTab('http://test.com');&quot; name=&quot;command&quot; value=&quot;nonIframe&quot; background-image:url(../images/URL/Test.png);&quot; class=&quot;submit&quot; /&gt;
  </code></pre>
  <h3>Javascript</h3>
  <pre><code>//Function OpenInNewTab
  function OpenInNewTab(url) {
      var win = window.open(url, '_blank');
      win.focus();
      return false;
  }
  </code></pre>
  <p>I was playing with this script, but it only closes the current tab. I want the current tab to be open and close all other tabs or close the entire browser itself.</p>
  <h3>Javascript</h3>
  <pre><code>&lt;script language=&quot;JavaScript&quot;&gt;
      function closeIt() {
          close();
      }
  &lt;/script&gt;
  </code></pre>
  <h3>HTML</h3>
  <pre><code>&lt;center&gt;
      &lt;form&gt;
          &lt;input type=button value=&quot;Close Window&quot; onClick=&quot;closeIt()&quot;&gt;
      &lt;/form&gt;
  &lt;/center&gt;
  </code></pre>
  <p>Any suggestions would be really appreciated.
  Thank You</p>