title: check if a browser tab is already open so I don't make extra tabs
body: <p>When a user adds an item to our shopping cart it opens our store in a new tab. Different websites oddly enough.</p>
  
  <p>I would like to check if the tab is already open and then repopulate it it with the second item instead of opening another tab with the updated cart.</p>
  
  <p>Is there a way to check this with js? I imagine I can track that we opened the tab but I don't see how I can confirm that it wasn't closed in the time between adding items to the cart without doing some ajax requests pinging both pages etc. Which seems like overkill.</p>
  
  <p>So simply how do you check if a browser tab is already open?</p>
  
  <p>Edited with a solution:
  First:</p>
  
  <pre><code>var tab = window.open('http://google.com','MyTab');
  </code></pre>
  
  <p>Then:</p>
  
  <pre><code>if(tab) {
    var tab = window.open('http://yahoo.com','MyTab');
  }
  </code></pre>