mardi 28 mars 2017

From firebase storage download file to iframe

With below code, I can not download image to iframe. Instead, it downloaded to local drive.

in JS:

  storageRef.child('images/CopyPerson.jpg').getDownloadURL().then(function(url) {
  var iframe1 = document.getElementById('downloadedCourse');
  iframe1.src = url;
}).catch(function(error) {
  // Handle any errors
});

in html:

  <iframe id="downloadedCourse" width="800" height="500" src=""></iframe>

However, if I use img instead of iframe, it works as supposed. The reason I need use iframe is because I intend to download pdf file. Anyone knows why?




Aucun commentaire:

Enregistrer un commentaire