linktesy / index.html
abeea's picture
Update index.html
ec77e55 verified
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Redirecting…</title>
<script>
(function () {
const videoId = "CFkqTrXgiTo";
const webUrl = "https://www.youtube.com/watch?v=" + videoId;
const ytAppUrl = "youtube://" + videoId;
const androidIntent =
"intent://www.youtube.com/watch?v=" + videoId +
"#Intent;scheme=https;package=com.google.android.youtube;end";
const ua = navigator.userAgent.toLowerCase();
let attempts = 0;
const maxAttempts = 3;
function tryOpenApp() {
attempts++;
if (ua.includes("android")) {
window.location.href = androidIntent;
} else if (ua.includes("iphone") || ua.includes("ipad")) {
window.location.href = ytAppUrl;
}
// Retry if not opened
if (attempts < maxAttempts) {
setTimeout(tryOpenApp, 800);
} else {
// Final fallback after retries
setTimeout(() => {
window.location.href = webUrl;
}, 1200);
}
}
tryOpenApp();
})();
</script>
</head>
<body>
</body>
</html>