编程语言
首页 > 编程语言> > PHP PDF生成-IE7 / Acrobat8:“无法显示网站”

PHP PDF生成-IE7 / Acrobat8:“无法显示网站”

作者:互联网

在IE7中显示pdf(由R& OS的ezpdf生成)时遇到了一些麻烦.

带有Acrobat Reader 8.1.2的IE7.说“该页面无法显示”

其他浏览器(例如FF3 / Acrobat 8​​.1.2.或IE6 / Acrobat 7)对该文件没有问题.

服务器返回以下标头:

Date: Thu, 08 Jan 2009 10:52:40 GMT
Server: Apache/2.2.8 (Win32) mod_ssl/2.2.8 OpenSSL/0.9.8g PHP/5.2.5 DAV/2
X-Powered-By: PHP/5.2.5
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Length: 4750
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/pdf

有人知道如何解决此问题吗?

解决方法:

Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache

…因此IE不会将文件存储在Internet临时文件夹中.但是,用于从IE浏览器中直接“打开”文件的机制通常要求从“临时Internet文件”内部打开文件.从浏览器直接打开文件通常是不可靠的,尤其是在IE中. “另存为”效果更好.

考虑使用替代方法替换cachebusting标头,例如在URL中添加“?randomstring”参数.还可以考虑添加“ Content-Disposition:附件;文件名= …”标题,这将阻止插件尝试并且无法在浏览器UI中显示文件.

标签:pdf,pdf-generation,internet-explorer-7,php
来源: https://codeday.me/bug/20191210/2103747.html