GoogleChromeLabs / airhorn

Air horn
https://airhorner.com/
Other
365 stars 188 forks source link

How beforeinstallprompt event is fired every time the browser refresh? #46

Closed anshuPurohit closed 5 years ago

anshuPurohit commented 5 years ago

Google docs says it will be called only once in 3 months. If dismissed by a user, it will not be shown until a sufficient period of time (~3 months) has passed.

https://developers.google.com/web/updates/2018/06/a2hs-updates

const beforeinstallprompt = function(e) { promptEvent = e; promptEvent.preventDefault(); ga('send', 'event', 'install', 'available'); root.classList.add('available'); return false; };

window.addEventListener('beforeinstallprompt', beforeinstallprompt);

PaulKinlan commented 5 years ago

Did you dismiss it once you pressed the install button?