Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open ppt file in a new browser tab

A link that contains a .pdf such as the following opens in a new tab:

<a target="_blank" href="http://somePDF.pdf">Download</a>

Is it possible to make a Powerpoint file, .ppt, open in a new browser tab instead of making the user download the file?

I have tried this the following but this makes a user download the file:

<a target="_blank" href="http://somePPT.ppt">Download</a>

I am not sure if this is possible and have not been able to find any information on it so I am posting here.

like image 398
Mdd Avatar asked Jan 23 '13 20:01

Mdd


2 Answers

If the user's browser isn't able to display the file and has no plugin that can display the file, it will offer the file as a download.

If you can export the PowerPoint slides to PDF or HTML, they are more likely to be displayed in the browser.

like image 125
Fenton Avatar answered Sep 18 '22 02:09

Fenton


you could check if the browser has installed an pdf plugin, and if not use pdf.js to convert your pdf into an html page.

could look like this:

function hasPDFPlugin() {
   for(var i = 0; i < navigator.plugins.length; i++) {
      if(navigator.plugins[i].name.toLowerCase().indexOf('pdf') >== 0) {
        return true;
      }
   }
   return false;
}

if(!hasPDFPlugin()) {
  // do the pdf.js stuff
}
like image 36
hereandnow78 Avatar answered Sep 18 '22 02:09

hereandnow78