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 –