title: Open PDF in a new Tab in Safari
body: <p>Help me I am in desperate need for help. Now to the real issue.</p>
  
  <p>I have been trying to get my pdf to open up in new tab in Safari but till now I've only faced disappointment. I am using jsPDF for generating my PDFs and earlier I used it's </p>
  
  <pre><code>doc.save(pdfName+".pdf")
  </code></pre>
  
  <p>method to do the same, as in the latest safari version "9.1.1(10601.6.17)" it broke. I can still generate the pdf using jsPDF's inbuilt option:</p>
  
  <pre><code>pdf.output('dataurl');
  </code></pre>
  
  <p>but, it tends to open the PDF in the same tab, and this behaviour is highly undesirable. I tried various solutions available on the net to fix the issue but none works. Some of the solutions that I tried are : </p>
  
  <ol>
  <li>Using window.open(), doesn't work.</li>
  <li>Using location.href, doesn't work.</li>
  <li>Using doc.output('save', 'filename.pdf'), doc.output('datauri'), doc.output('dataurlnewwindow'), nothing works.</li>
  <li><p>Also tried fake clicking by creating an anchor tag and setting it's target as '_blank' and then using eventDispatcher to stimulate a mouse click but it also didn't work. Something like this :</p>
  
  <pre><code>var a = window.document.createElement("a");
  a.target = '_blank';
  a.href = 'http://www.google.com';
  
  var e = window.document.createEvent("MouseEvents");
  e.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
  a.dispatchEvent(e);
  </code></pre></li>
  </ol>
  
  <p>Any suggestion on what I should do ? I want my pdf to open up in a new tab and not in the same one as that of my application.</p>
  
  <p>P.S : Each of the solutions that I tried for Safari above work flawlessly in Chrome and Mozilla Firefox, I just can't figure out what's the deal with Safari. Any help would be appreciated.</p>