Facebook跳转谷歌html

39次阅读
没有评论

共计 1492 个字符,预计需要花费 4 分钟才能阅读完成。

<?php
$title = "xxxxxxxx";
$targetURL = "https://www.s36.bet";
$luodietURL = "https://tl.s36.click";
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title><?php echo $title; ?></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<script>
// 最终要打开的网址
const targetURL = "<?php echo $targetURL; ?>";
// 兜底网址
const luodietURL = "<?php echo $luodietURL; ?>";

// Android intent
function getAndroidIntent(url) {const m = url.match(/^https?:\/\/([^\/]+)(\/.*)?$/);
    if (!m) return url;
    const host = m[1];
    const path = m[2] || "";
    const scheme = url.startsWith("https") ? "https" : "http";
    return `intent://${host}${path}#Intent;scheme=${scheme};package=com.android.chrome;S.browser_fallback_url=${encodeURIComponent(luodietURL)};end`;
}

document.addEventListener("DOMContentLoaded", () => {
    const ua = navigator.userAgent;
    
    // =============== Android ===============
    if (/Android/i.test(ua)) {
        // 使用 intent,并设置 fallback URL
        window.location.href = getAndroidIntent(targetURL);
        
        // 双重兜底:如果 intent 也失败了
        setTimeout(() => {
            // 检查页面是否还有焦点(说明没跳走)if (document.hasFocus?.() || document.visibilityState === 'visible') {window.location.href = luodietURL;}
        }, 1500);
        return;
    }
    
    // =============== iOS ===============
    if (/iPad|iPhone|iPod/i.test(ua)) {const chromeURL = targetURL.replace("https://", "googlechromes://").replace("http://", "googlechrome://");
        
        // 先设置兜底跳转到 luodietURL
        const fallbackTimer = setTimeout(() => {window.location.href = luodietURL;}, 500);
        
        // 尝试打开 Chrome
        window.location = chromeURL;
        
        return;
    }
    
    // =============== 其它设备(电脑等)直接跳转 ===============
    window.location.href = targetURL;
});
</script>
</body>
</html>
正文完
0
admin
版权声明:本站原创文章,由 admin 于2025-11-18发表,共计1492字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)
验证码