判断当前系统类型,js

91 阅读1分钟

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();