fix: H5热更新不再document.write避免双重重叠
- localStorage命中时只更新版号+徽章,不重写页面 - 嵌入式按钮始终可见,可持续检查更新
This commit is contained in:
@@ -45,7 +45,10 @@ function applyUpdate(){
|
|||||||
(function(){
|
(function(){
|
||||||
var b=localStorage.getItem('gca_html'),v=localStorage.getItem('gca_ver');
|
var b=localStorage.getItem('gca_html'),v=localStorage.getItem('gca_ver');
|
||||||
if(b&&v&&v!==document.getElementById('ver').innerText){
|
if(b&&v&&v!==document.getElementById('ver').innerText){
|
||||||
document.open();document.write(b);document.close()
|
// Show badge but don't rewrite page (avoids double-render)
|
||||||
|
var el=document.createElement('span');el.className='badge';el.style.cssText='background:#22c55e;color:#000';
|
||||||
|
el.innerText='CACHED v'+v.replace('0.1.0-dav-android-','');document.querySelector('h1').appendChild(el);
|
||||||
|
document.getElementById('ver').innerText=v
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
</script></body></html>
|
</script></body></html>
|
||||||
|
|||||||
Reference in New Issue
Block a user