<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<button id='btn' onclick="test()">点击</button>
</body>
</html>
<script type="text/javascript">
var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
var isiOS = !!u.match(/(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
function test() {
if (isAndroid == true) {
location.href = "http://uri6.com/tkio/3aEfmya"
console.log("安卓手机")
} else {
location.href = "http://uri6.com/tkio/MBFbAva"
console.log("苹果手机")
}
}
</script>