判断设备是PC还是移动设备
var is_mobile = navigator.userAgent.toLowerCase().match(/(ipod|ipad|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i) != null;
if (is_mobile) {
window.location.href = "手机端";
} else {
window.location.href = "PC端";
}
下面这段代码即可判断当前移动设备是Android或者是IOS
(function () {
var u = navigator.userAgent,
app = navigator.appVersion;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
alert('是否是Android:' + isAndroid);
alert('是否是iOS:' + isiOS);
if (isAndroid) {
$("#choose").attr('capture', 'camera');
}
})();
判断当前设备是不是全面屏,结合上面代码一起使用
/**判断屏幕大小 */
fu