I have integrated PWA features in react web app and beforeinstallprompt event gets triggered in production app when opened in mobile. I want to trigger this event on desktop development environment. Is there a way to achieve that. I referred stackoverflow answer regarding this problem and updated chrome browser settings but the event is not triggered.
Asked
Active
Viewed 945 times
2
-
it also not triggereds if you have the app installed on your computer. do you also have deleted your storage? – bill.gates Jul 07 '20 at 13:52
-
Have you fully removed any previous tests installed but going to this URL in Chrome? --> chrome://apps/ – Mathias Jul 07 '20 at 13:53
-
no, I have not deleted storage? which storage are u referring to? – Always_a_learner Jul 07 '20 at 13:54
-
I have not installed this app before. checked in chrome apps. – Always_a_learner Jul 07 '20 at 13:54
-
1press F12, go to "Application" then go to "Clear Storage" and clear it – bill.gates Jul 07 '20 at 13:55
-
`window.addEventListener("appinstalled", function(){})` gets triggered if your app is installed – bill.gates Jul 07 '20 at 13:55
-
remember it has poor browser support – bill.gates Jul 07 '20 at 13:56
-
You are tying from an HTTPS URL? – Mathias Jul 07 '20 at 13:56
-
I am trying from http:localhost:3000 – Always_a_learner Jul 07 '20 at 13:57
-
it should work from localhost without SSL – bill.gates Jul 07 '20 at 13:57
-
HTTPS is a requirement for PWA installation. If you can, try a free host like Glitch to test if you do not have an HTTPS host. – Mathias Jul 07 '20 at 13:58
1 Answers
0
It depends on the browser. beforeinstallprompt is triggered on chrome 102 and edge 102 for me but not on firefox 101. it is not triggered if the app is already installed.
Check here for a list of supported browsers: https://developer.mozilla.org/en-US/docs/Web/API/BeforeInstallPromptEvent

Ainsof So'o
- 46
- 3