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;
});
};
},