Story/php

디바이스별 viewport 설정

Stdio 2012. 11. 29. 16:08
반응형

디바이스별 viewport 설정.
<?php if(strpos($_SERVER['HTTP_USER_AGENT'],"iPhone")){?>
 <meta name="viewport" content="width=device-width, initial-scale=0.67, maximum-scale=0.67, minimum-scale=0.67, user-scalable=no, target-densitydpi=medium-dpi" />
<?php }else if(strpos($_SERVER['HTTP_USER_AGENT'],"iPad")){?>
 <meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, width=device-width" />
<?php }else if(strpos($_SERVER['HTTP_USER_AGENT'],"Android 2")){?>
 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=yes, target-densitydpi=device-dpi" />
<?php }else if(strpos($_SERVER['HTTP_USER_AGENT'],"Android")){?>
 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=yes, target-densitydpi=device-dpi" />
<?php }else if(strpos($_SERVER['HTTP_USER_AGENT'],"Opera Mini")){?>
 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi" />
<?php }else if(strpos($_SERVER['HTTP_USER_AGENT'],"Opera 9")){?>
 <meta name="viewport" content="initial-scale=0.75, maximum-scale=0.75, minimum-scale=0.75, user-scalable=no" />
<?php }else if(strpos($_SERVER['HTTP_USER_AGENT'],"MSIE")){?>
 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi" />
<?php }else if(strpos($_SERVER['HTTP_USER_AGENT'],"FROYO")){?>
 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi" />
<?php }?>

반응형