Open taontech opened 1 year ago
使用?传递参数时,由于url会发生变化,对于html静态文件的缓存可能失效 号传参数的可以避免缓存失效
使用?传递参数时,由于url会发生变化,对于html静态文件的缓存可能失效
在列表页加载出来的冗余数据,通过local storage 传递到详情页,加上缓存的静态详情页html,实现瞬间加载详情页 //编写url位置 doGetJSON(configJSON,function(data){ config = data[document.domain] var bd = localStorage.getItem(getiid()) if(bd == undefined){ showMarkdown() }else{ showLocalMarkdown(bd) }
在列表页加载出来的冗余数据,通过local storage 传递到详情页,加上缓存的静态详情页html,实现瞬间加载详情页
//编写url位置 doGetJSON(configJSON,function(data){ config = data[document.domain] var bd = localStorage.getItem(getiid()) if(bd == undefined){ showMarkdown() }else{ showLocalMarkdown(bd) }
// change css var css = document.getElementById("themecss") css.setAttribute("href","themes/" + config.theme + ".css") })
### 如何在详情页刷新local storage? > 进入详情页后同时发起网络请求,成功后更新内容。此时画面会发生变化, 但是接口的缓存可能会不能马上看到效果 > 幸运的是,列表页返回的内容和详情页返回的内容结构一致
缓存策略决定传参方式
使用列表页加载出来的内容加速详情页加载。