最近无法在 IE11/10/9 上查看 PDF
PDF cannot be seen on IE11/10/9 recently
我是一家公司的网络开发人员。
从这周开始,我周围的所有同事和网络客户都不能再打开嵌入的pdf数据了。
我们传输数据协议的方式,data:application/pdf例子可以在plunkerhttp://embed.plnkr.co/Bjkypkht4RjIWE1AyFP0/index.html
中找到
简而言之,我们将数据放入data:application/pdf,并使用window.open()方法在浏览器中打开pdf二进制数据。
此功能在本周之前正常工作,实际上它已经在带有 pdf 附加组件或查看器插件的 IE/Firefox/Chrome 浏览器中工作了将近一年。
但是这周开始,所有IE版本都不能用了,报错如下,谁能帮我看看是什么原因?
Error displayed by IE:
The webpage cannot be displayed
Most likely cause:
Some content or files on this webpage require a program that you don't have installed.
请不要告诉我重置IE或enable/disable IE,这些方法我们都试过了,但都没有用。谢谢
Operating System:
Windows 7 Professional 64 bit
IE11(take this as an example):
Version: 11.0.9600.17728
Update Versions: 11.0.18(KB3038314)
Adobe PDF:
Name: Adobe PDF Reader
Publisher: Adobe Systems, Incorporated
Type: ActiveX Control
Architecture: 32-bit and 64-bit
Version: 11.0.10.32
File date: Tuesday, December 02, 2014, 10:31 PM
Date last accessed: Today, June 04, 2015, 2 hours ago
Class ID: {CA8A9780-280D-11CF-A24D-444553540000}
Use count: 1
Block count: 0
File: AcroPDF64.dll
Folder: C:\Program Files (x86)\Common Files\Adobe\Acrobat\Active
这是我使用 javascript 验证过的代码片段。
//create a Blob with an array and the optional dictionary object.
var TEST_PDF_DATA = data;
var byteCharacters = atob(TEST_PDF_DATA);
var charCodeFromCharacter = function(c) { return c.charCodeAt(0); }
var byteArrays = [];
for (var offset = 0; offset < byteCharacters.length; offset += 1000)
{
var slice = byteCharacters.slice(offset, offset + 1000);
var byteNumbers = Array.prototype.map.call(slice, charCodeFromCharacter);
byteArrays.push(new Uint8Array(byteNumbers));
}
var blob1 = new Blob(
byteArrays, //array
{ type: "application/pdf"} //dictionary object
);
//create a second blob that uses the first blob in its array
var blob2 = new Blob([blob1, "Those who understand binary and those who don't."]);
// Save the blob2 content to a file, giving both "Save" *and* "Open" options
window.navigator.msSaveOrOpenBlob(blob2, 'msSaveBlobOrOpenBlob_testFile.pdf');
alert('File saved using msSaveOrOpenBlob() - note the two "Open" and "Save" buttons below.');
我是一家公司的网络开发人员。
从这周开始,我周围的所有同事和网络客户都不能再打开嵌入的pdf数据了。
我们传输数据协议的方式,data:application/pdf例子可以在plunkerhttp://embed.plnkr.co/Bjkypkht4RjIWE1AyFP0/index.html
中找到
简而言之,我们将数据放入data:application/pdf,并使用window.open()方法在浏览器中打开pdf二进制数据。
此功能在本周之前正常工作,实际上它已经在带有 pdf 附加组件或查看器插件的 IE/Firefox/Chrome 浏览器中工作了将近一年。
但是这周开始,所有IE版本都不能用了,报错如下,谁能帮我看看是什么原因?
Error displayed by IE: The webpage cannot be displayed Most likely cause: Some content or files on this webpage require a program that you don't have installed.
请不要告诉我重置IE或enable/disable IE,这些方法我们都试过了,但都没有用。谢谢
Operating System: Windows 7 Professional 64 bit IE11(take this as an example): Version: 11.0.9600.17728 Update Versions: 11.0.18(KB3038314) Adobe PDF: Name: Adobe PDF Reader Publisher: Adobe Systems, Incorporated Type: ActiveX Control Architecture: 32-bit and 64-bit Version: 11.0.10.32 File date: Tuesday, December 02, 2014, 10:31 PM Date last accessed: Today, June 04, 2015, 2 hours ago Class ID: {CA8A9780-280D-11CF-A24D-444553540000} Use count: 1 Block count: 0 File: AcroPDF64.dll Folder: C:\Program Files (x86)\Common Files\Adobe\Acrobat\Active
这是我使用 javascript 验证过的代码片段。
//create a Blob with an array and the optional dictionary object.
var TEST_PDF_DATA = data;
var byteCharacters = atob(TEST_PDF_DATA);
var charCodeFromCharacter = function(c) { return c.charCodeAt(0); }
var byteArrays = [];
for (var offset = 0; offset < byteCharacters.length; offset += 1000)
{
var slice = byteCharacters.slice(offset, offset + 1000);
var byteNumbers = Array.prototype.map.call(slice, charCodeFromCharacter);
byteArrays.push(new Uint8Array(byteNumbers));
}
var blob1 = new Blob(
byteArrays, //array
{ type: "application/pdf"} //dictionary object
);
//create a second blob that uses the first blob in its array
var blob2 = new Blob([blob1, "Those who understand binary and those who don't."]);
// Save the blob2 content to a file, giving both "Save" *and* "Open" options
window.navigator.msSaveOrOpenBlob(blob2, 'msSaveBlobOrOpenBlob_testFile.pdf');
alert('File saved using msSaveOrOpenBlob() - note the two "Open" and "Save" buttons below.');