How to show custom 404 page using sw-toolbox sw-precache libraries for service-worker

197 Views Asked by At

I have an SPA which makes various http calls to get content from third party service and show content on the page. How do I configure /use sw-toolbox and sw-precache libraries, such that if http call fails due to being offline it shows a custom 404 page.

1

There are 1 best solutions below

1
On

you can achieve this b specifying a default router using

toolbox.router.default = "yourDefaultRoute";

more information on this can be found here : https://googlechrome.github.io/sw-toolbox/usage.html#the-default-route