zhxy-jsd/index.html

55 lines
2.3 KiB
HTML
Raw Permalink Normal View History

2025-04-22 10:22:33 +08:00
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8"/>
2025-12-20 21:46:38 +08:00
<!-- 版本号:每次发布时自动更新 -->
2025-12-24 19:42:28 +08:00
<meta name="version" content="20251223-185504">
2025-12-20 21:46:38 +08:00
<!-- HTML文件不缓存但允许静态资源缓存 -->
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
2025-04-22 10:22:33 +08:00
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
2025-12-24 19:42:28 +08:00
var log = false;
2025-12-20 21:46:38 +08:00
// 版本检查:如果检测到新版本,清除缓存并刷新
(function() {
try {
const currentVersion = document.querySelector('meta[name="version"]')?.getAttribute('content');
const storedVersion = localStorage.getItem('app_version');
if (storedVersion && storedVersion !== currentVersion && currentVersion) {
// 检测到新版本,清除所有缓存
if ('caches' in window) {
caches.keys().then(names => {
names.forEach(name => caches.delete(name));
});
}
// 更新版本号
localStorage.setItem('app_version', currentVersion);
// 强制刷新页面
window.location.reload(true);
} else if (currentVersion) {
// 首次访问或版本相同,保存版本号
localStorage.setItem('app_version', currentVersion);
}
} catch (e) {
// 版本检查失败不影响页面加载
console.warn('Version check failed:', e);
}
})();
2025-04-22 10:22:33 +08:00
</script>
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>