4

I've been getting this error message lately and I wonder why.

GET gs://example.appspot.com/images net::ERR_UNKNOWN_URL_SCHEME

Below are my references to the storage service:

var storage = firebase.storage();

var storageRef = storage.ref();

var storageRefImgs = storageRef.child('images');

I have Google Chrome 51 and I'm running Windows 10.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
M'Boulas
  • 133
  • 1
  • 2
  • 14

1 Answers1

10

It seems like you're putting the gs:// URL (which is an internal Google Storage reference) into a control that can't handle it (such as an img tag).

If you want to use the file in an img tag, you'll have to get the download URL for the file. From the documentation:

storageRef.child('images/stars.jpg').getDownloadURL().then(function(url) {
  // Get the download URL for 'images/stars.jpg'
  // This can be inserted into an <img> tag
  // This can also be downloaded directly
}).catch(function(error) {
  // Handle any errors
});
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • this seems to work. Thanks a lot. Now, I,m not using an tag, instead, I'm using a "background-image: url('img/pic.png')" in a
    . I'll post another question for that, since this question answered.
    – M'Boulas Jun 29 '16 at 06:12
  • what should I need to do to get all files from a location? – Jitendra Tiwari Jun 29 '16 at 10:39
  • That's unrelated to this question, but see: http://stackoverflow.com/questions/37335102/how-to-get-an-array-with-all-pictures/37337436#37337436 – Frank van Puffelen Jun 29 '16 at 16:58