Skip to content

Commit 72db136

Browse files
feat: add meta tag in noscript to refresh the page
1 parent bdb483a commit 72db136

1 file changed

Lines changed: 2 additions & 28 deletions

File tree

server/plugins/fallback-ui.ts

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,7 @@
11
export default defineNitroPlugin(nitroApp => {
22
nitroApp.hooks.hook('render:html', (html, { event }) => {
3-
if (event.path === '/spa.prerender-fallback.html' || event.path === '/200.html') {
4-
html.head.push(`
5-
<noscript>
6-
<style>
7-
.noscript-container {
8-
display: flex; flex-direction: column; align-items: center;
9-
justify-content: center; height: 100vh; font-family: sans-serif;
10-
background: #0a0a0a; color: white; text-align: center;
11-
}
12-
.refresh-button {
13-
margin-top: 20px; padding: 12px 24px; background: #444;
14-
color: white; text-decoration: none; border-radius: 6px;
15-
border: 1px solid #666; cursor: pointer;
16-
}
17-
.refresh-button:hover { background: #555; }
18-
</style>
19-
</noscript>
20-
`)
21-
22-
html.bodyAppend.push(`
23-
<noscript>
24-
<div class="noscript-container">
25-
<h2>Generating Page...</h2>
26-
<p>This page hasn't been cached yet. Click below to view the content.</p>
27-
<a href="." class="refresh-button">Check for Content</a>
28-
</div>
29-
</noscript>
30-
`)
3+
if (event.path.includes('/200.html')) {
4+
html.head.push('<noscript><meta http-equiv="refresh" content="3"></noscript>')
315
}
326
})
337
})

0 commit comments

Comments
 (0)