Piu*_*ojo 5 firebase firebase-hosting firebase-storage
所以我使用 firebase 存储来上传我的网站文件。以下是目录结构的示例:
\n\nProject\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 index.html\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 css\n\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 style.css\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 js\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 mainScript.js\nRun Code Online (Sandbox Code Playgroud)\n\n因此,我以这种结构将这些文件上传到 firebase,但我注意到返回的 downloadURL 在保留这种结构方面不是很友好。
\n\n例如,当我将 iframe 的 src 设置为 index.html.. 的 downloadURL 时,iframe 页面缺少样式和 mainScript 文件。
\n\n这是 downloadURL 查找 index.html 的方式:
\n\nhttps://firebasestorage.googleapis.com/v0/b/App_ID.appspot.com/o/index.html?alt=media&token=some_uid
\n\n这是 downloadURL 查找 style.css 的方式:
\n\n\n\n当然,index.html 文件正在寻找 style.css 文件:
\n\nhttps://firebasestorage.googleapis.com/v0/b/App_ID.appspot.com/o/css/style.css
\n\n但结果是 404。
\n\n有办法解决这个问题吗?
\n\n\n\nPS,当然我不想强迫用户更改文件中的网址......
\n
不要使用存储来保存您的网站文件!使用 Firebase 托管...Firebase 存储设计用于存储上传/下载文件(图像、音频等)
https://firebase.google.com/docs/hosting/
| 归档时间: |
|
| 查看次数: |
3181 次 |
| 最近记录: |