移动端兼容

47次阅读

共计 1380 个字符,预计需要花费 4 分钟才能阅读完成。

<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>
<title> 首页 </title>
<meta name=”keywords” content=”” />
<meta name=”description” content=”” />
<meta name=”HandheldFriendly” content=”true” />
<meta name=”MobileOptimized” content=”width” />
<meta id=”viewport” content=”width=device-width, user-scalable=no,initial-scale=1″ name=”viewport” />
<meta name=”apple-mobile-web-app-capable” content=”yes”>
<meta content=”black” name=”apple-mobile-web-app-status-bar-style” />
<meta content=”telephone=no” name=”format-detection” />
<!– 移动端版本兼容 –>
<script type=”text/javascript”>
var phoneW = parseInt(window.screen.width),phoneScale = phoneW/640 ,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, target-densitydpi=device-dpi”>’);}
} else {document.write(‘<meta name=”viewport” content=”width=640, user-scalable=no, target-densitydpi=device-dpi”>’);}
</script>
<link href=”css/all.css” type=”text/css” rel=”stylesheet”/>
<link href=”css/swiper.min.css” type=”text/css” rel=”stylesheet”/>
<link href=”css/index.css” type=”text/css” rel=”stylesheet”/>
<script src=”js/jquery-3.3.1.min.js”></script>
<script src=”js/swiper.min.js”></script>
</head>

正文完
 0