feat: implement automatic smart mobile app launcher with custom schemes and web fallbacks
All checks were successful
Build & Push Docker Image to Gitea Registry / build-and-push (push) Successful in 13s
All checks were successful
Build & Push Docker Image to Gitea Registry / build-and-push (push) Successful in 13s
This commit is contained in:
20
app.js
20
app.js
@@ -80,6 +80,26 @@ function createServiceCard(service) {
|
||||
</div>
|
||||
<span class="card-domain">${service.domain}</span>
|
||||
`;
|
||||
|
||||
if (service.mobileUrl) {
|
||||
card.addEventListener('click', (e) => {
|
||||
const isMobile = /Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
|
||||
if (isMobile) {
|
||||
e.preventDefault();
|
||||
const start = Date.now();
|
||||
// Versuch, die mobile App über ihr registriertes Custom URL-Schema zu öffnen
|
||||
window.location.href = service.mobileUrl;
|
||||
|
||||
// Web-Fallback nach 800ms, falls die App nicht installiert ist
|
||||
setTimeout(() => {
|
||||
if (Date.now() - start < 1500) {
|
||||
window.open(service.url, '_blank');
|
||||
}
|
||||
}, 800);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return card;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user