小编Gab*_*ico的帖子

有没有办法为urlCreator.createObjectURL(blob)创建文件名

我不太熟悉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

5
推荐指数
1
解决办法
5732
查看次数

标签 统计

javascript ×1