码迷,mamicode.com
首页 > 移动开发 > 详细

移动端meta标签的设置

时间:2015-06-18 11:03:29      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:

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, initial-scale= ‘ + phoneScale + " ,minimum-scale = " + phoneScale + ", maximum-scale = " + phoneScale + ‘, target-densitydpi=device-dpi">‘)
    } else {
        document.write(‘<meta name="viewport" content="width=640, initial-scale= ‘ + phoneScale + ‘ , target-densitydpi=device-dpi">‘)
    }
} else {
    document.write(‘<meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi">‘)
};

  

移动端meta标签的设置

标签:

原文地址:http://www.cnblogs.com/rainheader/p/4585042.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!