Skip to content

Commit

Permalink
Let the browser do the reload on http-equiv refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Mar 6, 2025
1 parent b3a77d8 commit a2a9869
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions assets/js/swup.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ const emitExdocLoaded = () => {
}

const maybeMetaRedirect = (visit, {page}) => {
const match = page.html.match(/<meta\s+http-equiv\s*=\s*["']refresh["']\s+content\s*=\s*["']\d+\s*;\s*url\s*=\s*([^"']+)["']/i)
const hasMetaRefresh = /<meta\s+http-equiv\s*=\s*["']refresh["']\s+content\s*=\s*["'][^"']*["']\s*\/?>/i.test(page.html)

if (match && match[1]) {
if (hasMetaRefresh) {
visit.abort()
window.location.href = match[1]
window.location.reload()
}
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a2a9869

Please sign in to comment.