通过JS来查询系统

通过JS来查询系统

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<script type="text/javascript">
var u = navigator.userAgent,
app = navigator.appVersion;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
// alert('是否是Android:'+isAndroid);
// alert('是否是iOS:'+isiOS);
if(isAndroid){
document.getElementById('email').href = "javascript:android_email()";
alert("这是安卓系统");
} else if (isiOS) {
document.getElementById('email').href = "mailto:service@sleepon.us?subject=Hello &body=Hello Sleep"
alert("这是ios系统");
} else {
document.getElementById('email').href = "mailto:service@sleepon.us?subject=Hello &body=Hello Sleep"
alert("这是Win系统")
};

function android_email(){
//window.location.href="protocol://h5?event=android_email"
alert('安卓触发成功')
};
</script>
© 2018 Ken的博客 All Rights Reserved. 本站访客数人次 本站总访问量