IOS-WEB Development Notes (1)

Source: Internet
Author: User

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/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.