我在我的 JavaScript 代码中使用了 angularjs
的 $http
提供者进行下载操作。
$http({
method: "POST",
url: "http://localhost:28494/api/print",
data: data,
responseType:'arraybuffer'
}).then(
function (response) {
var file = new Blob([response.data], {type: 'application/pdf'});
var objectUrl = URL.createObjectURL(file);
window.open(objectUrl,'_blank');
}
);
这会触发我的浏览器弹窗,我不想要这个。
但是我想直接下载,不要显示弹窗。
window.location = objectUrl
- ScrapCode