You will need to use a service worker on your website to use this feature. Copy-paste the line below, inside your service worker code loaded with the root scope.
wwwroot/service-worker.js
This assumes you have dumped your root service worker file to wwwroot/service-worker.js
.
Run this snippet of code with your website's javascript.
The window.addEventListener("load", function () {
code delay loads the service worker to ensure no performance metrics are affected.
This can be removed for quicker initialisation.
"serviceWorker" in navigator
conditional will ensure no exceptions are thrown.