1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
var jsVer = 15; var phoneWidth = parseInt(window.screen.width); var phoneScale = phoneWidth / 640;
var ua = navigator.userAgent; if (/Android (\d+\.\d+)/.test(ua)) { var version = parseFloat(RegExp.$1); if (version > 2.3) { document.write( '<meta name="viewport" content="width=640, minimum-scale = ' + phoneScale + ", maximum-scale = " + phoneScale + ', target-densitydpi=device-dpi">' ); } else { document.write( '<meta name="viewport" content="width=640, target-densitydpi=device-dpi">' ); } } else { document.write( '<meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi">' ); }
|