fix: 缓存命中用location.replace加载完整HTML(含JS执行)
- innerHTML不执行script标签导致按钮无响应 - location.replace到data: URI确保JS函数正常定义
This commit is contained in:
@@ -45,10 +45,7 @@ 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){
|
||||||
var d=document.implementation.createHTMLDocument();
|
location.replace('data:text/html;charset=utf-8,'+encodeURIComponent(b))
|
||||||
d.documentElement.innerHTML=b;
|
|
||||||
var newBody=d.body.innerHTML;
|
|
||||||
if(newBody){document.body.innerHTML=newBody;document.title=d.title}
|
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
</script></body></html>
|
</script></body></html>
|
||||||
|
|||||||
Reference in New Issue
Block a user