網頁檢查是否安裝APP

<html>
<head>
<title>判斷是否有安裝APP,若無,則詢問是否下載</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="images/css.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
    var isiPad = navigator.userAgent.match(/iPad/i) != null;
    var isiPhone = navigator.userAgent.match(/iPhone/i) != null;
    var isandroid = navigator.userAgent.match(/Android/i) != null;

    if(isandroid)
    {
        window.location.href='https://play.google.com/store/apps/details?id=com.fonestock.android.yourapp';
    }
    if(isiPad)
    {
        document.location = 'yourappurls://';
        setTimeout( function() {
            if( confirm( '您似乎沒有安裝, 這個APP, 進行下載?')) {
                document.location = 'http://itunes.apple.com/tw/app/id4179293XX';
            }
        }, 300);
    }
    if(isiPhone)
    {
        document.location = 'yourappurls://'; 
        setTimeout( function() {
            if( confirm( '您似乎沒有安裝, 這個APP, 進行下載?')) {
                document.location = 'http://itunes.apple.com/tw/app/id4179293XX';
            }
        }, 300);
    }


</script>

</head>
<body>

</body>
</html>
by mhchen15 on 6 1 月, 2014 in Javascript - Tags: ,
Tags: ,

There are no comments.

Name*: Website: E-Mail*:
XHTML: You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>