Navigator 对象包含有关浏览器的信息
注释:没有应用于 navigator 对象的公开标准,不过所有浏览器都支持该对象。

获取设备类型
function getDeviceType() {var ua = navigator.userAgent;ua=ua.toLowerCase();if (ua.indexOf("iphone") != -1 || ua.indexOf("ipad") != -1 || ua.indexOf("ipod") != -1) {//苹果return '3';} else if (ua.indexOf("android") != -1) {//安卓return '2';}return '2';}
检查网络
function check_network(){if(!navigator.onLine){mui.toast("网络断开中,请检查网络设置")return}}
