APP自识别安卓苹果

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>XX-APP</title>
<meta name="viewport" content="width=device-width,maximum-scale=1,target-densitydpi=320,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta http-equiv="x-dns-prefetch-control" content="off">
<style type="text/css">
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,button,textarea,p,blockquote,th,td {-webkit-text-size-adjust:none;margin:0;padding: 0;}fieldset,img,html,body,iframe{border:0;}
</style>
</head>
 
<body style="background:#e8e8e8;">
<img style="display:none;100%;" id="tip" src="images/tip.jpg">
<script type="text/javascript">
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf('micromessenger') > 0) {
                document.getElementById('tip').style.display = 'block';
}else if (ua.indexOf('mobile') > 0) {
if (ua.indexOf('android') > 0) {
location.href = "安卓下载地址?rand="+Math.floor(Math.random()*(1000+1));
} else{
                location.href="苹果商店下载地址";
}
} else{
location.href="安卓下载地址?rand="+Math.floor(Math.random()*(1000+1));
};
</script>
        <script type="text/javascript" src="images/jquery.js">
</body>
</html>
 
原文地址:https://www.cnblogs.com/oldking/p/6728259.html