js判断设备信息,安卓、ios、还是pc端

前端开发获取设备信息的代码
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) { window.location.href ="https://itunes.apple.com/cn/app/1hao-yao-dian/id727578007?mt=8"; } else if (/(Android)/i.test(navigator.userAgent)) { window.location.href ="https://itunes.apple.com/cn/app/1hao-yao-dian/id727578007?mt=8"; } else { window.location.href ="http://www.111.com.cn/"; };
posted @ 2018-07-12 18:16  极客小乌龟  阅读(345)  评论(0编辑  收藏  举报