简体   繁体   English

在新的浏览器选项卡中打开ppt文件

[英]Open ppt file in a new browser tab

A link that contains a .pdf such as the following opens in a new tab: 包含.pdf的链接(如下所示)将在新选项卡中打开:

<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? 是否可以在新的浏览器选项卡中打开Powerpoint文件.ppt,而不是让用户下载文件?

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. 我不确定这是否可行,并且无法找到任何相关信息,所以我在这里发帖。

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. 如果可以将PowerPoint幻灯片导出为PDF或HTML,则它们更有可能在浏览器中显示。

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. 您可以检查浏览器是否安装了pdf插件,如果不使用pdf.js将您的pdf转换为html页面。

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
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM