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

viewport 640宽的做法 针对iphone和安卓单独设置

时间:2014-11-30 13:55:37      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:android   style   blog   http   io   ar   color   sp   java   

<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="utf-8" />
<meta HTTP-EQUIV="pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<meta HTTP-EQUIV="expires" CONTENT="0">
<meta name="apple-touch-fullscreen" content="yes" />
<meta name="format-detection" content="telephone=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta http-equiv="Expires" content="-1" />
<meta http-equiv="pragram" content="no-cache" />

<base href="http://app.cntcma.com/">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>第二届京津冀协同发展论坛</title><meta name="sharecontent" data-msg-img=‘http://app.cntcma.com/attachments/image/20141113/20141113205001_32033.png‘ data-msg-title=‘第二届京津冀协同发展论坛‘ data-msg-content=‘敬请关注‘ data-msg-callBack=‘‘ data-line-img=‘http://app.cntcma.com/attachments/image/20141113/20141113205001_32033.png‘ data-line-title=‘第二届京津冀协同发展论坛‘ data-line-callBack=‘‘ />
<script type="text/javascript">
if(/Android (\d+\.\d+)/.test(navigator.userAgent)){
        var version = parseFloat(RegExp.$1);
        if(version>2.3){
            var phoneScale = parseInt(window.screen.width)/640;
            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">);
    }

//微信去掉下方刷新栏
    if(RegExp("MicroMessenger").test(navigator.userAgent)){
        document.addEventListener(WeixinJSBridgeReady, function() {
            WeixinJSBridge.call(hideToolbar);
        });
    }    
</script>

参考的页面:http://app.cntcma.com/wx/35f4a8d465e6e1edc05f3d8ab658c551.html

viewport 640宽的做法 针对iphone和安卓单独设置

标签:android   style   blog   http   io   ar   color   sp   java   

原文地址:http://www.cnblogs.com/pengpengsay/p/4132887.html

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