if (isIOS) { //ios let regStr_saf = /os [\d._]*/gi; let verinfo = userAgent.toLowerCase().match(regStr_saf); var ver = (verinfo + "").replace(/[^0-9|_.]/ig, "").replace(/_/ig, "."); alert(ver); }
识别ios系统设备并获取版本号
let isIOS = userAgent.toLowerCase().indexOf("like mac os x") > 0; //ios终端
if (isIOS) { //ios let regStr_saf = /os [\d._]*/gi; let verinfo = userAgent.toLowerCase().match(regStr_saf); var ver = (verinfo + "").replace(/[^0-9|_.]/ig, "").replace(/_/ig, "."); alert(ver); }
if (isIOS) { //ios let regStr_saf = /os [\d._]*/gi; let verinfo = userAgent.toLowerCase().match(regStr_saf); var ver = (verinfo + "").replace(/[^0-9|_.]/ig, "").replace(/_/ig, "."); alert(ver); }