beforeinstallprompt not firing automatically
Reported by
brajmina...@gmail.com,
May 22 2018
|
||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36 Steps to reproduce the problem: I want to add to my app "Add To home screen banner", I went through the manual https://developers.google.com/web/fundamentals/engage-and-retain/app-install-banners/#testing-the-app-install-banner Have fulfilled the conditions Manifest file { "name": "Project clean as pwa", "short_name": "Pro Clean", "icons":[ { "src": "/icons/icons8-washing-machine-48.png", "type": "image/png", "sizes": "48x48" }, { "src": "/icons/icons8-washing-machine-96.png", "type": "image/png", "sizes": "96x96" }, { "src": "/icons/app-icon-192x192.png", "type": "image/png", "sizes": "192x192" }, { "src": "/icons/icons8-washing-machine-480.png", "type": "image/png", "sizes": "480x480" }, { "src": "/icons/icons8-washing-machine-512.png", "type": "image/png", "sizes": "512x512" } ], "start_url":"/initial", "scope": "../", "display":"standalone", "orientation":"any", "background_color":"#fff", "theme_color":"#3f51b5", "description":"Simple dry clean description", "dir":"ltr", "lang":"en-US" } Registered service worker if("serviceWorker" in navigator){ navigator.serviceWorker.register('/sw.js') .then(function(){ console.log("Service worker registered"); }); }; Added fetch event handler in serviceworker file self.addEventListener("fetch",function(event){ event.respondWith(fetch(event.request)); }); Saving beforeinstallprompt event for later use window.addEventListener("beforeinstallprompt",function(event){ console.log("beforeinstallprompt fired");//this never appears after waiting for long event.preventDefault(); event.prompt(); deferredPrompt = event; return false; }); Using the event later function collectOrder(){ console.log("Using the event ", deferredPrompt);//on call of the funtion the event comes undefined if(deferredPrompt){ deferredPrompt.prompt(); deferredPrompt.userChoice.then(function(choiceResult){ console.log(choiceResult.outcome); if(choiceResult.outcome==="dismissed") console.log("User cancelled installation"); else console.log("User added to homescreen"); }); deferredPrompt = null; }; } The lighthouse test says the app is pass for "install banner" What is the expected behavior? The install banner should appear. What went wrong? The banner never appeared. Did this work before? No Chrome version: 66.0.3359.181 Channel: stable OS Version: 6.1 (Windows 7, Windows Server 2008 R2) Flash Version:
,
May 22 2018
,
May 23 2018
brajminator65@ Thanks for the issue. Request you to provide the details of the app and the steps to reproduce the issue which will help in further triaging. A screen cast of the steps followed will be helpful in further triaging of the issue. Thanks..
,
Today
(2 hours ago)
As there isn't any info/Feedback from reporter since long time, hence closing this issue and marking it as Won't Fix. @Reporter: Please feel free to file a new one if the issue still persists. Thanks! |
||||
►
Sign in to add a comment |
||||
Comment 1 by chrishtr@chromium.org
, May 22 2018