无互联网连接时重定向到缓存页面

Redirect to cached page when No internet connection

有两个页面 A 和 B。页面 A 是正常的 Html 页面,而页面 B Html 使用缓存清单的页面。

任务:如果互联网连接不可用,页面 A 重定向到页面 B。

问题: 由于重定向使用 HTTP 请求,页面 B 未加载显示 无互联网连接

有没有办法从页面 A 重定向到页面 B?

您是否尝试在清单中提供 FALLBACK header?

# Fallback content
FALLBACK:
. example.html

If the (request) attempt fails, due to either a network failure or a server error of some kind, the browser loads the file example.html instead.

https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache