有时候需要通过js来判断当前系统来执行不同操作
function getDeviceType() {
var userAgent = navigator.userAgent;
if (userAgent.match(/iPhone|iPad|iPod/i)) {
return 'iOS';
} else if (userAgent.match(/Android/i)) {
return 'Android';
} else {
return 'PC';
}
}
var deviceType = getDeviceType();
此时deviceType得到的就是当前系统(iOS或Android或PC)
1955

被折叠的 条评论
为什么被折叠?



