IOS-WEB開發筆記(1)

來源:互聯網
上載者:User

最近公司要做一個新項目,所以及時的記錄一些東西,方便開發的時候使用:

檢測ipad及iphone、ipod,以及jQTouch的庫

原文猛擊:

http://davidwalsh.name

http://net.tutsplus.com/tutorials/tools-and-tips/learn-how-to-develop-for-the-iphone/

一.ipad版本

1.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

2.ipad - javascript

// For use within normal web clients var isiPad = navigator.userAgent.match(/iPad/i) != null;// For use within iPad developer UIWebView// Thanks to Andrew Hedges!var ua = navigator.userAgent;var isiPad = /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');

二.iphone版本

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();}

三.檢測iPad螢幕方向 

<link rel="stylesheet" media="all and (orientation:portrait)"href="portrait.css"><link rel="stylesheet" media="all and (orientation:landscape)"href="landscape.css">

動畫demo:http://ofps.oreilly.com/titles/9780596805784/

開發:https://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/Introduction/Introduction.html

seo小技巧:http://sinobloger.org/tag/ipad-web%E5%BC%80%E5%8F%91/

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.