title: Binding window.open response object to an html element?
body: <p>Here I'm trying to use <code>.data()</code> to store the object data from the <code>window.open</code> function.
  But it doesn't seem to work, all I get is <code>undefined</code> for the <code>dataWin</code> variable.</p>
  
  <p>I'm wondering how to accomplish a function that will open a new window when a window isn't open, otherwise only <code>.focus()</code> on an already open window, using <code>window.open</code>. Because when I use <code>window.open</code> on the same window name it causes the new window to refresh, which is a problem for my app.</p>
  
  <p>If there is a way to store an object into variable so it can be binded to a unique html element?<br>
  I try and just get <code>undefined</code></p>
  
  <p>Or, Is there a way to check if a window is already open by WINDOW NAME?
  (After searching on google didn't find anything that could do it)</p>
  
  <p>Anyways here's what I'm trying, without any luck:</p>
  
  <pre><code>function OpenNewWindow_Or_FocusOpenWindow(name) {
  
  dataWin = $("#id-" + name).data('winData')
  
  if (dataWin == 'undefined') { windowClosed = true }
  else { windowClosed = dataWin.closed }
  
  
    if ( windowClosed == true ) {
      newWin = window.open('myurl' , "win" + name , 'options');
      $("#id-" + name).data('winData',newWin);
      if (newWin != null) { newWin.focus() }
    }
    else {
      dataWin.focus();
    }
  
  }
  </code></pre>