ipad有一个用户代理字符串;
Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us)
AppleWebKit/531.21.10 (KHTML, like Gecko)
Version/4.0.4 Mobile/7B334b Safari/531.21.10
您可以在标头或服务器级别检测并重新定向用户代理。(这些示例仅适用于iPad,而不是iPhone或safari)。
PHP:
$isiPad = strpos( $_SERVER[ \'HTTP_USER_AGENT\' ],\'iPad\' ) !== false;
。htaccess:
RewriteCond %{HTTP_USER_AGENT} ^.*iPad.*$
RewriteRule ^(.*)$ http://whateverurlyouwant.example.com [R=301]
Javascript:
var isiPad = navigator.userAgent.match(/iPad/i) != null;
媒体查询:
media="only screen and (max-device-width: 1024px)"