二维码URL自己主动辨别Android和ISO设备,以便扫码后倒入不同的下载链接

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body style="background: #f3f3f3; margin:0;">
<p></p>
<script> 
;(function () {
    var ua = navigator.userAgent,
        isAndroid = /android/ig.test(ua),
        isIos = /iphone|ipod|ipad/ig.test(ua),
        isMicroMessenger = /MicroMessenger/ig.test(ua);
 
    if (isMicroMessenger) {
        if (isIos) {
            document.body.innerHTML = '<img style="width:100%" src="image/ios_download.jpg">';
        } else if (isAndroid) {
            document.body.innerHTML = '<img style="width:100%" src="image/android_download.jpg">';
        }
    } else {
        if (isIos) {
            location.href = 'http://XXXXXX';
        } else if (isAndroid) {
            location.href= 'http://XXXXX.apk';
        }
    }
 
})()
</script>
</body>
</html>

posted @ 2016-03-24 15:17  zfyouxi  阅读(260)  评论(0编辑  收藏  举报