Recently, the company wants to create a new project, so we can record something in time to facilitate development:
Detects iPad, iPhone, iPod, andJqtouch Library
Original article:
Http://davidwalsh.name
Http://net.tutsplus.com/tutorials/tools-and-tips/learn-how-to-develop-for-the-iphone/
I. iPad version
1. iPad user proxy string
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
2. iPad-Javascript
//For use within normal web clientsVaRIsipad = navigator. useragent. Match (/iPad/I )! =Null;//For use within iPad developer uiwebview//Thanks to Andrew hedges!VaRUA =Navigator. useragent;VaRIsipad =/iPad/I. Test (UA) |/iPhone OS 3_1_2/I. Test (UA) |/iPhone OS 3_2_2/I. Test (UA );
3. iPad-PHP
$ Isipad= (Bool)Strpos($ _ Server['HTTP _ user_agent '], 'ipad ');
Ii. iPhone version
1. iPhone-Javascript
If(Navigator. useragent. Match (/iPhone/I) | (navigator. useragent. Match (/iPod/I ))){If(Document. Cookie. indexof ("iphone_redirect = false") =-1) window. Location = "http://m.espn.go.com/wireless? IPhone & I = Comr";}
2. iPhone-PHP
If(Strstr($ _ Server['HTTP _ user_agent '], 'iphone') |Strstr($ _ Server['HTTP _ user_agent '], 'ipod')){Header('Location: http://yoursite.com/iphone');Exit();}
III.IPad screen Orientation Detection
<LINK rel = "stylesheet" Media = "All and (orientation: Portrait)" href = "portrait.css"> <LINK rel = "stylesheet" Media = "All and (orientation: landscape) "href =" landscape.css ">
Animation demo: http://ofps.oreilly.com/titles/9780596805784/
Development: https://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/Introduction/Introduction.html
Small Seo tips: http://sinobloger.org/tag/ipad-web%E5%BC%80%E5%8F%91/