【发布时间】:2018-05-07 11:38:59
【问题描述】:
按照 Firebase 教程实现 Firebase 托管。在控制台中托管应用程序。但问题是当我更改了我的 html 模板并通过运行在 Firebase 控制台中重新部署时
ionic build --browser
和
firebase deploy
它正在部署,但没有在移动浏览器中更新。
例如,我创建了一个 ionic and angular 演示项目。使用 InAppBrowser 可以连接 Firebase url
this.iab.create('https://xxx-xxxx.firebaseapp.com','_blank',"location=no,clearsessioncache=yes,clearcache=yes");
但是当我试图在应用程序设置中清除应用程序缓存时。然后我得到输出
上面的图片,带有更新的文字。上传到 Firebase 后的预期结果。
下面 sn -p 试图限制缓存。
1. clearsessioncache=yes,clearcache=yes given in InAppBrowser
2.在 Firebase.json 中
"headers": [ {
"source" : "**/*.@(eot|otf|ttf|ttc|woff|font.css)",
"headers" : [ {
"key" : "Access-Control-Allow-Origin",
"value" : "*"
} ]
}, {
"source" : "**/*.@(jpg|jpeg|gif|png)",
"headers" : [ {
"key" : "Cache-Control",
"value" : "max-age=7200"
} ]
}, {
"source" : "404.html",
"headers" : [ {
"key" : "Cache-Control",
"value" : "max-age=300"
} ]
} ],
"cleanUrls": true
我不确定,问题出在 InAppBrowser 或 Default Browser 还是需要在 ionic 3 应用程序中进行任何配置?
【问题讨论】:
-
您的浏览器正在加载浏览器中的缓存版本。将 html 文件的缓存控制减少到几分钟,并将静态文件的缓存控制设置得非常高。
标签: angular firebase caching ionic3 firebase-hosting