[w3c/manifest] Allowing only site-triggered install prompt (#627)

Hi guys, do you really like this idea, that a user-agent will "analyze" a website somehow and decide, if it is appropriate to show an install prompt? It can be disturbing, if the "analysis" is wrong. I am using the following code to be able to trigger an install prompt.
    
    window.addEventListener("beforeinstallprompt", function(e){  e.preventDefault();  myEvent=e;  });
    if ("serviceWorker" in navigator)  navigator.serviceWorker.register("sw.js", { scope: "./" });  
    //  I call myEvent.prompt();  later, when user clicks Install

The problem I have is, that if both the website and the user want the site to be installed, the user-agent itself becomes an obstacle (by not dispatching "beforeinstallprompt"). What about replacing it all with this:

    navigator.install();

It can throw an exception, when installing is not appropriate. If you think there is a risk of "attack" by calling it too often, we can deal with it the same way we deal with alert(...). Imagine if alert(...); worked only on Mondays and only between 12th and 37th minute of each hour. That is how I see the current draft now.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/issues/627

Received on Monday, 13 November 2017 09:24:50 UTC