Firefox不会缓存PDF文档

时间:2012-12-05 15:34:50

标签: firefox pdf browser-cache cache-control content-disposition

我正在使用Perl在我的网站上提供动态创建的GIF和PDF。例如:

<img src="file.pl?f=image.gif" />
<a href="file.pl?f=doc.pdf">Document</a>

内容将在访问者的浏览器中缓存一段预定的时间,并且在下载之前会提示访问者打开或保存PDF。

为此,我发出以下HTTP响应标头。

对于GIF:

HTTP/1.1 200 OK
Status: 200 OK
Content-Type: image/gif
Etag: "MD5 hash"
Expires: Wed, 05 Dec 2012 14:30:00 GMT
Last-Modified: Wed, 05 Dec 2012 14:00:00 GMT
Cache-Control: public, max-age=1800

对于PDF:

HTTP/1.1 200 OK
Status: 200 OK
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="doc.pdf"
Etag: "MD5 hash"
Expires: Wed, 05 Dec 2012 14:30:00 GMT
Last-Modified: Wed, 05 Dec 2012 14:00:00 GMT
Cache-Control: public, max-age=1800
Content-Description: file transfer
Content-Transfer-Encoding: binary

如果我在Firefox中导航到about:cache?device=disk,则内容会在 3.6.28 及更早版本(Windows操作系统)中正确缓存。但是,只有GIF在Firefox 4 + 中缓存。

我尝试在安全模式下启动Firefox以查看插件是否导致问题,但PDF仍未缓存。我也尝试将内容类型更改为application/pdf,但也没有运气。

有什么建议吗?

感谢。

0 个答案:

没有答案