if ('serviceWorker' in navigator) {

navigator.serviceWorker.register('/sw.js');

};

About This Quote

Nice guide going over service workers.