获取 gs://example.appspot.com/images net::ERR_UNKNOWN_URL_SCHEME

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

我最近一直收到此错误消息,我想知道为什么。

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

以下是我对存储服务的引用:

var storage = firebase.storage();

var storageRef = storage.ref();

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

我有 Google Chrome 51 我是 运行 Windows 10.

您似乎将 gs:// URL(这是内部 Google 存储引用)放入无法处理它的控件(例如 img标签)。

如果您想在 img 标签中使用该文件,则必须 get the download URL 该文件。来自文档:

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
});