chore: main 병합 — 다시 연 탭 로딩 멈춤 수정
This commit is contained in:
commit
fbb0c475d0
2 files changed
+27
-2
No files matched your search
@@ -10,6 +10,30 @@
|
||||
|
||||
gtag('config', 'G-D378J4X373');
|
||||
</script>
|
||||
<script>
|
||||
// 이미 열었던 탭을 다시 열면 브라우저가 예전 HTML 을 다시 쓰고, 그 HTML 이 부르는 예전 빌드 파일은 배포로 지워져 첫 화면에서 멈춘다.
|
||||
// 빌드 파일을 못 받았거나 12초 지나도 첫 화면이 그대로면 한 번만 새로 불러온다 (30초 안에 또 하지는 않는다)
|
||||
(function () {
|
||||
var KEY = 'nalssigak.bootReload'
|
||||
function reloadOnce() {
|
||||
try {
|
||||
var last = Number(sessionStorage.getItem(KEY) || 0)
|
||||
if (Date.now() - last < 30000) return
|
||||
sessionStorage.setItem(KEY, String(Date.now()))
|
||||
} catch (e) {
|
||||
console.error('[boot] storage', e)
|
||||
}
|
||||
location.reload()
|
||||
}
|
||||
window.addEventListener('error', function (e) {
|
||||
var el = e.target
|
||||
if (el && (el.tagName === 'SCRIPT' || el.tagName === 'LINK') && /\/assets\//.test(el.src || el.href || '')) reloadOnce()
|
||||
}, true)
|
||||
setTimeout(function () {
|
||||
if (document.getElementById('boot')) reloadOnce()
|
||||
}, 12000)
|
||||
})()
|
||||
</script>
|
||||
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4414665130371841" crossorigin="anonymous"></script>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
|
||||
+3
-2
@@ -52,13 +52,14 @@ server {
|
||||
}
|
||||
|
||||
location @static {
|
||||
add_header Cache-Control "no-cache";
|
||||
add_header Cache-Control "no-store";
|
||||
try_files $uri.html /index.html;
|
||||
}
|
||||
|
||||
# HTML 은 no-store: no-cache 면 다시 연 탭·뒤로 가기에서 예전 HTML 을 다시 써서, 배포로 지워진 빌드 파일을 부르다 멈춘다
|
||||
# SPA: /gak 처럼 빌드 때 만든 페이지별 HTML(gak.html)이 있으면 그것을, 없으면 index.html. 폴더는 안 찾는다 (/season 이 이미지 폴더 public/season 과 겹쳐 403)
|
||||
location / {
|
||||
add_header Cache-Control "no-cache";
|
||||
add_header Cache-Control "no-store";
|
||||
try_files $uri $uri.html /index.html;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user