fix: 缓存命中用location.replace加载完整HTML(含JS执行)

- innerHTML不执行script标签导致按钮无响应
- location.replace到data: URI确保JS函数正常定义
This commit is contained in:
LukeMackin
2026-07-21 18:51:59 +08:00
parent 4d6bb3ff6f
commit 123824a734

View File

@@ -45,10 +45,7 @@ function applyUpdate(){
(function(){
var b=localStorage.getItem('gca_html'),v=localStorage.getItem('gca_ver');
if(b&&v&&v!==document.getElementById('ver').innerText){
var d=document.implementation.createHTMLDocument();
d.documentElement.innerHTML=b;
var newBody=d.body.innerHTML;
if(newBody){document.body.innerHTML=newBody;document.title=d.title}
location.replace('data:text/html;charset=utf-8,'+encodeURIComponent(b))
}
})();
</script></body></html>