📱 Installer Juste 1 Clic
Installez l'application sur votre appareil pour un accès rapide, même hors ligne.
// PWA Install Prompt let deferredPrompt; const installPrompt = document.getElementById('pwa-install-prompt'); window.addEventListener('beforeinstallprompt', (e) => { e.preventDefault(); deferredPrompt = e; // Show prompt after 30 seconds if not dismissed before const dismissed = localStorage.getItem('pwa-prompt-dismissed'); if (!dismissed) { setTimeout(() => { installPrompt.classList.add('show'); }, 30000); } }); function installPwa() { if (deferredPrompt) { deferredPrompt.prompt(); deferredPrompt.userChoice.then((choiceResult) => { if (choiceResult.outcome === 'accepted') { console.log('PWA: User accepted install'); } deferredPrompt = null; installPrompt.classList.remove('show'); }); } } function dismissPwaPrompt() { installPrompt.classList.remove('show'); localStorage.setItem('pwa-prompt-dismissed', 'true'); } // Hide prompt if app is installed window.addEventListener('appinstalled', () => { installPrompt.classList.remove('show'); deferredPrompt = null; console.log('PWA: App installed'); });