The Offline-Fallback Page

Learn how to show a custom fallback page to the user when the app fails to fetch the requested asset.

Background

A situation arises in providing offline availability to the user with the help of caching when the user is offline, and we don’t have the requested asset in the cached form. In this scenario, the user will see the network error, “This site can’t be reached,” because the network request will fail offline.

A straightforward workaround is to add a catch() block to the fetch method to handle any errors.

Get hands-on with 1200+ tech skills courses.