msSaveBlob在IE10版本10.0.9200.16844上发布

时间:2015-01-11 04:41:54

标签: javascript internet-explorer-10 browser-feature-detection blobs version-numbering

我在IE 10上使用msSaveBlob和msSaveOrOpenBlob方法时遇到了问题。这些方法似乎适用于IE 11和IE 10版本10.0.9200.17183,但API在IE 10版本10.0.9200.16844上失败。

我正在尝试此网站上的示例1代码http://msdn.microsoft.com/en-us/library/ie/hh779016%28v=vs.85%29.aspx#blobbuilder

<!DOCTYPE html>
<html>

<head>
  <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  <title>Example 1</title>
</head>

<body>
<h1>Example 1</h1>
<script>
var blobObject = new Blob(["I scream. You scream. We all scream for ice cream."]); 

window.navigator.msSaveBlob(blobObject, 'msSaveBlob_testFile.txt'); // The user only has the option of clicking the Save button.
alert('File save request made using msSaveBlob() - note the single "Save" button below.');

var fileData = ["Before you insult a person, walk a mile in their shoes. That way, when you insult them, you'll be a mile away - and have their shoes."];
blobObject = new Blob(fileData);
window.navigator.msSaveOrOpenBlob(blobObject, 'msSaveBlobOrOpenBlob_testFile.txt'); // Now the user will have the option of clicking the Save button and the Open button.
alert('File save request made using msSaveOrOpenBlob() - note the two "Open" and "Save" buttons below.');
</script>
</body>

</html>

以下是两个版本的IE 10的行为屏幕截图 Screenshot of behavior on the two versions of IE 10

是否有另一种方法可以在方法失败的IE 10版本上导出blob?

1 个答案:

答案 0 :(得分:1)

仅在IE10 Platform Preview 4及更高版本上支持Blob:

  

Platform Preview 4增加了对BlobBuilder的支持,BlobBuilder是开发人员创建新文件的一种方式。 IE10还有两种新方法,允许用户将blob保存到他们的计算机上,在处理客户端驻留数据时可以实现出色的端到端体验。

<强>参考