iPad 使用的是 Safari Mobile 浏览器,他的的 User Agent 是:

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 浏览器呢,关键是看它的 User Agent 中是否有 iPad。

Javascript

function is_iPad(){ var ua = navigator.userAgent.toLowerCase(); if(ua.match(/iPad/i)=="ipad") { return true; } else { return false; } }

PHP

$is_iPad = (bool) strpos($_SERVER['HTTP_USER_AGENT'],'iPad');

htaccess

RewriteCond %{HTTP_USER_AGENT} ^.*iPad.*$ RewriteRule ^(.*)$ http://ipad.fairyfish.net [R=301]
如果是 iPad 浏览器,跳转到 iPad 页面。
本文转自:我爱水煮鱼 原文链接:http://fairyfish.net/m/ipad-user-agent/


Last modification:June 25th, 2021 at 08:35 pm
If you think my article is useful to you, please feel free to appreciate