Skip to content
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

39 lines (33 sloc) 1.02 KB
<!doctype html>
<title>installing service worker</title>
<script type="text/javascript">
//Register the service worker
if("serviceWorker" in navigator) {
console.log('ServiceWorker register with scope: ', reg.scope);
}).catch(function(err) {
console.log('ServiceWorker registration failed: ', err);
console.log('SW is not supported');
//intercept beforeinstallprompt event and show the Add to Homescreen prompt
window.addEventListener('beforeinstallprompt', (event) => {
console.log('beforeinstallprompt event fired')
event.userChoice.then((choice) => {
if (choice.outcome === 'accepted') {
console.log('User accepted the A2HS prompt');
} else {
console.log('User dismissed the A2HS prompt');
You can’t perform that action at this time.