我正在從indexedDB讀取一個base64編碼文件,並試圖鏈接到它作爲blob url。下面的代碼在Chrome中正常工作,但是當我點擊IE10中的鏈接時,什麼也沒有發生。我可以看到鏈接的屬性,href是blob:66A3E18D-BAD6-44A4-A35A-75B3469E392B看起來沒錯。任何人看到我做錯了什麼?createObjectURL在ie10中不起作用
下載附件
//convert the base64 encoded attachment string back into a binary array
var binary = atob(attachment.data);
var array = [];
for(var i = 0; i < binary.length; i++) {
array.push(binary.charCodeAt(i));
}
//create a blob from the binary array
var myBlob=new Blob([new Uint8Array(array)], {type: attachment.content_type});
//create a url hooked to the blob
downloadURL = (window.webkitURL ? webkitURL : URL).createObjectURL(myBlob);
//set the attachment link to the url
$('#attachmentLink').attr("href", downloadURL);
$("#attachmentLink").text(fileName);
您是否諮詢過IE的開發人員工具以查看是否遇到錯誤? – Madbreaks