how to make pwa app installable code example
Example 1: pwa install
buttonInstall.addEventListener('click', (e) => { // Hide the app provided install promotion hideMyInstallPromotion(); // Show the install prompt deferredPrompt.prompt(); // Wait for the user to respond to the prompt deferredPrompt.userChoice.then((choiceResult) => { if (choiceResult.outcome === 'accepted') { console.log('User accepted the install prompt'); } else { console.log('User dismissed the install prompt'); } });});
Example 2: How to make PWAs installable js
if('serviceWorker' in navigator) {
navigator.serviceWorker.register('./pwa-examples/js13kpwa/sw.js');
};