본문 바로가기
Infra & Server Dev

모바일 웹에서 티스토어 설치유무 판단후 다운링크가기

by 필팔청춘 2013. 7. 11.

<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta charset="utf-8">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<script type="text/javascript">


var isIPHONE = (navigator.userAgent.match('iPhone') != null || navigator.userAgent.match('iPod') != null);

var isIPAD = (navigator.userAgent.match('iPad') != null);

var isANDROID = (navigator.userAgent.match('Android') != null);


 

function executeApp(url) {

if (isANDROID) {

location.href = "tstore://PRODUCT_VIEW/0000386538/0";

}

        installApp();

        if (isIPHONE || isIPAD) {

//                 window.location.href = url;

        } else if (isANDROID) {

                $('applinkDiv').innerHTML = '<iframe src="' + url + '" width="0" height="0" frameborder="0"></iframe>';

                setTimeout(function(){

                        var b = $('applinkDiv');

                        var c = b.getElementsByTagName('iframe');

                        if (c.length > 0) { b.removeChild(c[0]); }

                }, 1000);

        }

}

 

function installApp() {

        var b = new Date();

        setTimeout(function(){

                if (new Date() - b < 500) {

                        if (isANDROID) {

                            location.href = "market://details?id=com.inucompany.honeybridge9";

                        }

                }

        }, 500);

        if (isIPHONE || isIPAD) {

                                location.href = "http://itunes.apple.com/app/id661986436?mt=8";

                        } 

}


</script>

</head>

<body>


<script type="text/javascript"> 

window.onload=function() { executeApp("tstore://PRODUCT_VIEW/0000386538/0"); } 

</script> 


<div id="applinkDiv"></div>

</body>

</html>


참고 : http://blog.taks.pe.kr/34