js判断客户端是pc端还是移动端
$(function() { if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) { //alert(navigator.userAgent); window.location.href ="iPhone.html"; } else if (/(Android)/i.test(navigator.userAgent)) { //alert(navigator.userAgent); window.location.href ="https://hao.360.cn/"; } else { window.location.href ="https://web.sogou.com/?11621"; }; })
//判断系统是不是ios function isIos() { //拿到用户信息 var userAgentInfo = navigator.userAgent; var Agents = 'iPhone'; if(userAgentInfo.indexOf(Agents) > 0) { //如果是ios return true; } else { //不是ios return false; } }