title: How do I programatically force Chrome to show PDF file in a new tab?
body: <p>I am aware that one can do this manually (hold Ctrl down when clicking the PDF link).</p>
  
  <p>But I need a solution like this:</p>
  
  <p>-- when a user  clicks on the link that generates the PDF, Chrome will  either display the PDF in-browser <strong>in a new tab</strong> </p>
  
  <p>or </p>
  
  <p>-- override that behavior and show the download dialog.</p>
  
  <p>Any ideas?</p>
  
  <p>MORE INFO:</p>
  
  <p>On my page there is a form that is submitted to generate the PDF. The form is submitted using a combination of <code>anchor</code> and <code>jquery submit</code>.</p>
  
  <p>The PDF is then returned to the browser - on FF I get the download dialog, but on Cr I get the PDF loaded in the same tab.</p>
  
  <pre><code>//form elements
  
  &lt;a id="submit" target="_blank" href="http://example.com/#"&gt;download pdf&lt;/a&gt;
  
  
  &lt;script&gt;
  
  $('#submit').click(function(e) {
  
      e.preventDefault();
  
      $('#lost_form').submit();
  
  });
  
  &lt;/script&gt;
  </code></pre>