移动端适配不同设备(缩放效果)

// 非360基线显示适配
if (/Android (\d+\.\d+)/.test(navigator.userAgent)) {
    var version = parseFloat(RegExp.$1);
    if (version > 2.3) {
        var phoneScale = parseInt(window.screen.width) / 360;
        document.write('+ phoneScale + ', minimum-scale=' + phoneScale + ', maximum-scale=' + phoneScale + ', target-densitydpi=device-dpi">');
    }
    else {
        document.write('');
    }
}
else {
    document.write('');
}

你可能感兴趣的:(javascript)