Stop networking in webview after loading remote content

My Electron app loads, caches and updates remote html content in a webview with a service worker (sw) when online. The content is loaded from the sw cache when offline.

This is working well in testing on OS X, Linux, and Windows 10 (win32 build). Mp4 videos play smoothly from the sw cache, even when the devices are online.

The same win32 build installed on Windows 7 does not play Mp4 videos from the cache when online – it (re)loads them from the network, causing long waits and choppy play back on slow networks (e.g. 1MBs).

Is there a way to disable networking in the Electron shell after content has loaded/updated, thus forcing video playback from cache?


I found a partial solution to the mp4 playback when online issue: adding the no-cache metatag to html content pages: <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">

I held off doing this, fearing it would also disable the service worker cache, but this turned out not to be the case. Playback when online is much improved, and offline unaffected.