function openApp(deepLink) { const fallback = 'https://www.bgeneral.com/appbg'; const start = Date.now(); // Intentar abrir app window.location.href = deepLink; // Fallback si no abre setTimeout(function () { const elapsed = Date.now() - start; if (elapsed < 2000) { window.location.href = fallback; } }, 1500); } // Asignar evento a todos los botones con la clase document.querySelectorAll(".open-appBG").forEach(button => { button.addEventListener("click", function () { const deepLink = this.dataset.link; if (deepLink) { openApp(deepLink); } }); });