我不太熟悉Javascript,有没有办法创建自己的文件名?发生的情况是它将打开一个新选项卡,并且文件名采用Guid格式。
if (urlCreator && headers['content-type'] != 'application/octet-stream') {
// Fallback to $window.location method
try {
// Prepare a blob URL
// Use application/octet-stream when using $window.location to force download
var objectUrl = urlCreator.createObjectURL(blob);
$window.open(objectUrl);
success = true;
} catch (ex) {
//console.log("Download link method with $window.location failed with the following exception:");
//console.log(ex);
}
}
Run Code Online (Sandbox Code Playgroud) javascript ×1