html - Firefox 不显示内联 pdf

标签 html http pdf firefox

我想将 pdf 内联显示到 iframe 中。它适用于 Chrome,但不适用于 Firefox(最新)。

HTML

<iframe src="/3.pdf"></iframe>

服务器 HTTP 响应(参见 content-disposition: inline)

HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
vary: Origin
access-control-allow-credentials: true
content-disposition: inline; filename=3.pdf
content-type: application/pdf
date: Fri, 20 Sep 2019 10:56:36 GMT
connection: close
transfer-encoding: chunked

结果

enter image description here

最佳答案

您可以尝试使用嵌入或对象标签,如下所示:

<html>
<body>
    <embed src="/3.pdf" width="500" height="375">
</body>
</html>

关于html - Firefox 不显示内联 pdf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58027111/

相关文章:

http - http 响应中没有 Cache-Control header 的 ETag

r - 当 output_dir 包含空格时,使用 Rmarkdown 生成 PDF 文档时出错

javascript - 使用单选按钮更改 Div 的背景图像

javascript - 单击滑动到可滚动 div JQuery 中的内容

android - 登录 API 服务器失败

r - pdf 设备尺寸不一致

pdf - 一个很好的 .net 的 PDF View 组件

javascript - jQuery 选择更改时的交换选项

使用正则表达式将搜索短语或搜索词替换为 <b> 匹配 </b> 的 php 代码

java - 具有简历功能的 PHP 上传文件