0
我在Firefox和Chrome中遇到了一個非常奇怪的錯誤。 Safari中不會發生該錯誤。我用下面的代碼的網頁上顯示PDF(正常工作):點擊顯示PDF和Firefox的頁面上的「返回」按鈕導致標題出現在<body>標記
header('Content-Length: ' . filesize($pdfPath));
header('Content-Type: application/pdf');
header('Content-Transfer-Encoding: binary');
header('Content-Disposition: inline; filename="' . $pdfId . '.pdf"');
readfile($pdfPath);
的PDF加載粉墨登場,但是當我點擊瀏覽器的後退按鈕(Firefox和Chrome),該頁面我跳回到正文標籤中包含HTTP標頭。
HTTP/1.1 200 OK Date: Tue, 08 Mar 2011 00:18:47 GMT Server: Apache/2.0.63 (Unix) PHP/5.2.13 DAV/2 mod_ssl/2.0.63 OpenSSL/0.9.7l X-Powered-By: PHP/5.2.13 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: 7010 Keep-Alive: timeout=15, max=92 Connection: Keep-Alive Content-Type: text/html
此標題適用於當前頁面(不是顯示PDF的頁面)。在調試時,我打印出身體標記和下列jQuery代碼:
console.log($('body').html());
頭在身體的任何其它內容之前出現。任何關於什麼可能導致這個流氓標題出現的想法?