0

The following code can be used to install the program in the PWA:

            var fab = document.querySelector('#fab');
            var deferredPrompt;

            fab.addEventListener('click', function () {

                if (deferredPrompt) {
                    deferredPrompt.prompt();
                    deferredPrompt.userChoice.then(function (choice) {
                        if (choice.outcome === 'dismissed') {
                            console.log('installation was cancelled');
                        } else {
                            console.log('User Added To Home Screen');
                        }
                    });
                    deferredPrompt = null;
                }
            });
         
         //********************************************************************

            window.addEventListener('beforeinstallprompt', function (event) {
                console.log('beforeinstallprompt run .');
                event.preventDefault();
                deferredPrompt = event;
                return false;
            });

now for Uninstall:

It can only be removed from the browser

enter image description here

Now my question is here:

Is it possible to create a code such as manual installation (mentioned above) that the user can uninstall the program without the need to use the browser tool?

Thank you all for your answers

jason
  • 11
  • 2
  • In Chrome, you can enter this in the toolbar to see all installed apps "chrome://apps/" - without the quotes and then right click on the app to remove it from Chrome. – Mathias Nov 15 '21 at 22:12
  • Have you found a way to achieve this? I'm trying to remove a PWA by javascript code, but the only thing I could do is unregister its service worker and cache content, only that. – Rigoberto Peña Feb 01 '22 at 04:54

0 Answers0