I want to use the add to homescreen function of pwa's.
I made a pwa of my app and for testing purposes Im using http-server to run it https://www.npmjs.com/package/http-server
When I run audits I get a score of 92. the only fail is "Does not redirect HTTP traffic to HTTPS". But passed audits include: "user can be prompted to Install the Web App" and "Site is served over HTTPS"
in chrome://flags/ I have 'bypass user engagement checks and app banners enabled'
For testing I'm listening to the beforeinstallprompt event, for now, I'm listening to the event in the ngoninit part of my homepage with:
window.addEventListener('beforeinstallprompt', e => {
console.log('beforeinstallprompt Event fired');
});
but when I press "add to home screen" in dev tools, nothing is logged in the console.
How can I catch the beforeinstallprompt-event?
Any help is greatly appreciated!