title: Open .pdf files in new tab and not download - Javascript
body: <p>I have a quick question, I have my javaScript code setup where it downloads any ".pdf" files that I have on my JavaScript table. How do I make it where it doesn't download the file, but instead opens it up in a new tab?</p>
  
  <p>Here is the code:</p>
  
  <p>JavaScript file: o365FileSlide.js
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function(){
   var current_title = $(document).attr('title');
   
   if(current_title == 'Introduction to OneDrive')
    getOneDriveFiles();
  });
  
  function getOneDriveFiles(){
   //PnP call here
  
   $pnp.setup({
    baseUrl: "/TrainingResourceCenter/O365Training/"
   });
  
   $pnp.sp.web.getFolderByServerRelativeUrl("/TrainingResourceCenter/O365Training/Shared Documents/OneDrive/").files.orderBy("Title").get().then(function(f){
    console.log(f);
    
    var files = '';
    
    $.each(f, function(index, value){
     var filesHtml = "&lt;div class='file'&gt;" + 
         "&lt;a href='" + value.ServerRelativeUrl + "'&gt;&lt;img src='/O365Training/PublishingImages/wordThumbSmall.png' width='75px' height='75px' /&gt;&lt;/a&gt;" + 
         "&lt;a href='" + value.ServerRelativeUrl + "'&gt;&lt;p id='fileTitle' margin-top: 10px&gt;" + value.Title + "&lt;/p&gt;&lt;/a&gt;" + 
         "&lt;/div&gt;";
     
     files = files + filesHtml;
    });
    
    $(".files").append(files).window.open(files);
    
   });
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="filesDiv" class="row" style="padding-left: 15px;"&gt;
      &lt;div class="files" target="_blank"&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;script type="text/javascript" src="/publiccdnlib/apps/O365-Slider/o365FileSlide.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><a href="https://i.stack.imgur.com/VBmcc.png" rel="nofollow noreferrer">https://i.stack.imgur.com/VBmcc.png</a></p>
  
  <p>If anyone could give me some pointers, I would really appreciate it! Thanks.</p>