且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从Firebase存储下载文件到iframe

更新时间:2023-01-03 15:17:02

I presume that this is because the content-disposition header is set to attachment instead of inline. Try setting the metadata to change this and see if that works:

// Obviously you only have to set the metadata once per file
// Not every time you download the URL
storageRef.child('images/CopyPerson.jpg').updateMetadata({
  "contentDisposition": "inline"  
}).then(function() {
  return storageRef.child('images/CopyPerson.jpg').getDownloadURL()
}).then(function(url) {
  var iframe1 = document.getElementById('downloadedCourse');
  iframe1.src = url;
});