我正在尝试让用户一次打开或保存多个文档,但是在这种方式下,我对这种方式并不满意,因为现在用户必须多次单击保存并打开才能查看文件,想知道是否有可能首先获得响应(即用户是否要打开或保存)然后执行操作
for (var i = 0; i < values.data.length; i++) {
//for browser compatibility
var ieEDGE = navigator.userAgent.match(/Edge/g);
var ie = navigator.userAgent.match(/.NET/g); // IE 11+
var oldIE = navigator.userAgent.match(/MSIE/g);
var name = "file";
var charactersArray = atob(values.data[i].PDF);
var len = charactersArray.length;
var byteArray = new Uint8Array(len);
for (var j = 0; j < len; j++) {
byteArray[j] = charactersArray.charCodeAt(j);
}
if (ie || oldIE || ieEDGE) {
var blob = new window.Blob([byteArray], { type: 'application/pdf' });
var fileName = name + '.pdf';
//window.navigator.msSaveOrOpenBlob(blob, fileName);
navigator.msSaveBlob(blob, fileName);
}
}