0

i have a PWA with VUEJS i need help making this code to work on iPhones. On Android it works perfect. The button appears if the person has not yet installed the application, but if it is already installed, the button disappears. IOS does not have a prompt, but I would like to add a button that, when clicked, takes the user to the installation of the pwa.

data() {
        return {
            installBtn: 'block',
            installer: undefined,
},
created(){
        const self = this;

       let installPrompt;
       window.addEventListener("beforeinstallprompt", e => {
           e.preventDefault();
           installPrompt = e;
           this.installBtn = "block";

       });

       this.installer = () => {
           this.installBtn = "none";
           installPrompt.prompt();
           installPrompt.userChoice.then(result => {
               if(result.outcome === "accepted") {
                   console.log("User Accepted");
               } else {
                   console.log("User denied");
               }
               installPrompt = null;
           });
       };
},
ivanmercado9
  • 29
  • 1
  • 3
  • 2
    Does this answer your question? [PWA: How to programmatically trigger : "Add to homescreen"? on iOS Safari](https://stackoverflow.com/questions/51160348/pwa-how-to-programmatically-trigger-add-to-homescreen-on-ios-safari) – DevArenaCN Jan 15 '20 at 20:34

1 Answers1

2

I don't think iOS Safari currently support web app install banner right now. See https://stackoverflow.com/a/51160938/4472488

DevArenaCN
  • 131
  • 3
  • 17