(function () {
		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) {
				// andriod 2.3以上
				document.write('<meta name="viewport" content="width=640, minimum-scale = ' + phoneScale + ', maximum-scale = ' + phoneScale + ', target-densitydpi=device-dpi">');
			} else {
			// andriod 2.3
				document.write('<meta name="viewport" content="width=640, target-densitydpi=device-dpi">');
			}
			// IOS及其他系统
		} else {
			document.write('<meta name="viewport" content="width=640, user-scalable=no">');
		}
	})()

  

posted on 2016-06-03 11:48  FreeSpider  阅读(590)  评论(0编辑  收藏  举报