Html 如何确保在单页应用程序中刷新页面
我有一个使用Aurelia编写的单页应用程序。它工作得很好 但是,当我推出更新时,有时很难让浏览器刷新缓存的页面,因此它会显示较旧的版本 已尝试,刷新浏览器,控制F5 我们也把它放在index.html的头部Html 如何确保在单页应用程序中刷新页面,html,aurelia,systemjs,Html,Aurelia,Systemjs,我有一个使用Aurelia编写的单页应用程序。它工作得很好 但是,当我推出更新时,有时很难让浏览器刷新缓存的页面,因此它会显示较旧的版本 已尝试,刷新浏览器,控制F5 我们也把它放在index.html的头部 <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Expires" content="-1"> <meta http-equiv="CACHE-CONTROL" content="N
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="CACHE-CONTROL" content="NO-CACHE">
但我不认为当system.js获取单个组件时,上述操作会产生任何影响。经过进一步搜索,我发现这解释了如何使用SystemJs缓存bust
var systemLocate = System.locate;
System.locate = function(load) {
var System = this;
return Promise.resolve(systemLocate.call(this, load)).then(function(address) {
if(address.lastIndexOf("html.js") > -1) return address;
if(address.lastIndexOf("css.js") > -1) return address;
return address + System.cacheBust;
});
};
System.cacheBust = '?bust=' + Date.now();
System.import('aurelia-bootstrapper');
所以,当您开发所有内容时,这是一个问题吗?或者用户可能会在旧版本上“工作”?这只是最终用户的问题。但我找到了答案,将发布。