gpt4 book ai didi

html - PDF 未加载到对象标签中

转载 作者:行者123 更新时间:2023-12-03 09:23:27 25 4
gpt4 key购买 nike

pdf 路径没问题,但浏览器不会在对象标签中加载 PDF。

响应 header :

Accept-Ranges:bytes
Connection:keep-alive
Content-Disposition:attachment; filename=1.pdf
Content-Length:234790
Content-Type:application/pdf
Date:Tue, 28 Oct 2014 14:26:16 GMT
Last-Modified:Wed, 09 Jul 2014 14:00:55 GMT
Server:nginx/0.7.67
Set-Cookie:sessionid=1c64bc0b9ab545d9f7568c09a8ed6fe3; httponly; Path=/

目标代码:

<object data="http://example.com/protected/documents/7" type="application/pdf">
<p>File:
<a href="/protected/documents/7" target="_blank" class="turquesa">
/protected/documents/7
</a>
</p>
</object>

如果我单击后备链接,我就会下载 PDF,因此服务器工作正常。

所以...有什么想法吗?

最佳答案

问题在于 Content-Disposition header 。 “附件”告诉浏览器下载文件而不是内联显示它。如果您能够更改响应,使其显示为“内联”,则问题将得到解决。

关于html - PDF 未加载到对象标签中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26611123/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com