Disable browser cache: Add no-cache headers to HTML and fetch requests
This commit is contained in:
parent
0db9ad896d
commit
d74328959e
@ -3,6 +3,9 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<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">
|
||||
<title>章节目录 - 阿拉德:剑之回响</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
|
||||
@ -3,6 +3,9 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<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">
|
||||
<title>阿拉德:剑之回响 - 沉浸式阅读体验</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
|
||||
@ -15,11 +15,23 @@ async function loadChaptersData() {
|
||||
try {
|
||||
// 格式化章节号(带前导零)
|
||||
const chapterId = chapterNum.toString().padStart(2, '0');
|
||||
const response = await fetch(`data/chapter-${chapterId}.json`);
|
||||
const response = await fetch(`data/chapter-${chapterId}.json`, {
|
||||
cache: 'no-store',
|
||||
headers: {
|
||||
'Cache-Control': 'no-cache',
|
||||
'Pragma': 'no-cache'
|
||||
}
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
// 尝试不带前导零的格式
|
||||
const response2 = await fetch(`data/chapter-${chapterNum}.json`);
|
||||
const response2 = await fetch(`data/chapter-${chapterNum}.json`, {
|
||||
cache: 'no-store',
|
||||
headers: {
|
||||
'Cache-Control': 'no-cache',
|
||||
'Pragma': 'no-cache'
|
||||
}
|
||||
});
|
||||
if (!response2.ok) break;
|
||||
const data = await response2.json();
|
||||
chapters.push(normalizeChapterData(data, chapterNum));
|
||||
|
||||
@ -3,6 +3,9 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<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">
|
||||
<title>{{CHAPTER_TITLE}} - 阿拉德:剑之回响</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user