Nice I didn’t know about navigator.onLine
. Since it is widely supported, the service worker will now display the cached offline page only when the user is offline.
https://github.com/discourse/discourse/commit/d2d3c7d24e733b1db8bd187df1f2b004d18d6ca2