Capacitor app just caches website pages

How could a capacitor app be made which is just a middle-man between the web server we already have and the device’s persistent storage?

So that the first time a page is requested, the app pulls it from the server and displays the normal HTML, but the next time the same page is requested, the app just displays it from the version saved in the device.

Has anyone ever seen or tried this before?

Use the normal browser-provided service worker API