title: window.open and pop-up blocker in $.ajax().done()
body: <p>I have an ajax call through jQuery; when it completes I need to open an URL in a new tab.</p>
  
  <p>I wrote this simple function:</p>
  
  <pre><code>var openWin = function() {
      window.open('/UrlToOpen', '_blank');
      win.focus();
  }
  </code></pre>
  
  <p>If I call this function directly from JS code, it opens without triggering the pop-up blocker.  </p>
  
  <p>If I call it from $.ajax().done(), like this:  </p>
  
  <pre><code>$.ajax({
          url: 'ajaxUrl',
          type: 'POST'
      }).done(function (result) {
          openWin();
  }); 
  </code></pre>
  
  <p>The pop-up blocker is triggered.</p>
  
  <p>Demonstration here: <a href="https://jsfiddle.net/dggwL5uj/" rel="nofollow">https://jsfiddle.net/dggwL5uj/</a></p>
  
  <p>Why? How can I avoid this?</p>