0
I have the same application running in 2 different domains, one is examplo.com
and the other exemplo2.com
In this application has a button on which the user can click to download the application, this button disappears when the user performs the download. But if I access the same application on a different domain, the button stays there
How to solve?
const buttonAddToHomeScreen = document.querySelector('#addToHomeScreen');
let deferredPrompt;
window.on('beforeinstallprompt', function(event) {
event.preventDefault();
deferredPrompt = event;
buttonAddToHomeScreen.style.display = 'block';
buttonAddToHomeScreen.style.opacity = '1';
});
buttonAddToHomeScreen.on('click', function() {
if (!deferredPrompt) return;
deferredPrompt.prompt();
deferredPrompt.userChoice.then(function() {
buttonAddToHomeScreen.style.display = 'none';
buttonAddToHomeScreen.style.opacity = '0';
deferredPrompt = null;
});
});