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/"; };
原文地址:https://www.cnblogs.com/gopark/p/9300992.html