javascripthtmlhttp-redirectcache-manifest

Redirect to cached page when No internet connection


There are two pages A & B. Page A is normal Html page while Page B Html page using Cache Manifest.

Task: If Internet Connection is not available, Page A redirects to Page B.

Issue: As redirection use HTTP Request, Page B is not loaded showing No Internet connection

Is there any way to redirect from Page A to Page B?


Solution

  • Have you tried to provide a FALLBACK header in your manifest?

    # 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