judge_model(){
var events = navigator.userAgent;
if(events.indexOf('Android')>-1 || events.indexOf('Linux')>-1 || events.indexOf('Adr')>-1){
console.log("安卓手机");
}else if(events.indexOf('iPhone')>-1){
console.log(screen.width,screen.height)
//根据尺寸进行判断 苹果的型号
if(screen.height == 932 && screen.width == 430){
console.log("iPhone14ProMax");
}else if(screen.height == 926 && screen.width == 428){
console.log("iPhone12ProMax iPhone13ProMax");
}else if(screen.height == 844 && screen.width == 390){
console.log("iPhone12Pro iPhone13Pro");
}else if(screen.height == 812 && screen.width == 375){
console.log("iPhoneX");
}else if(screen.height == 896 && screen.width == 414){
console.log("iPhoneXR");
}else if(screen.height == 736 && screen.width == 414){
console.log("iPhone7P - iPhone8P - iPhone6")
}else if(screen.height == 667 && screen.width == 375){
console.log("iPhone7 - iPhone8 - iPhone6")
}else if(screen.height == 568 && screen.width == 320){
console.log("iPhone5")
}else{
console.log("iPhone4")
}
}else if(events.indexOf('Windows Phone')>-1){
console.log("诺基亚手机")
}else if(events.indexOf("iPad")>-1){
console.log("平板")
}
}
移动端判断各类机型
最新推荐文章于 2024-07-10 14:03:37 发布