1
我已經按照我的AngularJS應用程序在新標籤中打開一個文本文件來保存打開的Blob網址:在新標籤頁(IE)
$scope.createString()
.then(function() {
var windowReference = window.open();
var blob = new Blob([$scope.createdString], { type: 'text/plain' });
var url = (window.URL || window.webkitURL).createObjectURL(blob);
windowReference.location = url;
});
但是,這是行不通的。它只會在新標籤中打開相同的鏈接,但不會創建Blob-Url。
我該怎麼做?我該如何做到這一點?
UPDATE:
我完成了它在IE這樣的:
$scope.createString()
.then(function() {
var blob = new Blob([$scope.createdString], { type: 'text/plain' });
window.navigator.msSaveOrOpenBlob(blob, 'Test.txt');
});
但有與所有瀏覽器的標準化方法?
請參閱https://stackoverflow.com/questions/24007073 /開鏈接國產按createobjecturl功能於IE11 –