WEB开发网
开发学院手机开发iPhone 开发 iPhone和iPad开发入门 阅读

iPhone和iPad开发入门

 2010-06-02 03:44:00 来源:WEB开发网   
核心提示:2if (document.cookie.indexOf("iphone_redirect=false") == -1) window.location = "http://m.espn.go.com/wireless/?iphone&i=COMR";3}The PHP1if(s

2

if (document.cookie.indexOf("iphone_redirect=false") == -1) window.location = "http://m.espn.go.com/wireless/?iphone&i=COMR";

3

}

The PHP

1

if(strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'],'iPod'))

2

{

3

header('Location: http://yoursite.com/iphone');

4

exit();

5

}

iPad浏览器探测

The Javascript

1

var isiPad = navigator.userAgent.match(/iPad/i) != null;

The PHP

1

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

The .htaccess

1

RewriteCond %{HTTP_USER_AGENT} ^.*iPad.*$

2

RewriteRule ^(.*)$ http://ipad.yourdomain.com [R=301]

iPhone & iPod touch窗口方向探测

The Javascript

1

function orient()

2

{

3

switch(window.orientation){

4

case 0: document.getElementById("orient_css").href = "css/iphone_portrait.css";

5

break;

6

case -90: document.getElementById("orient_css").href = "css/iphone_landscape.css";

7

break;

8

9

case 90: document.getElementById("orient_css").href = "css/iphone_landscape.css";

10

break;

11

12

}

13

14

window.onload = orient();

iPad窗口方向探测

1

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

2

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

jQTouch移动设备框架

上一页  1 2 3 4  下一页

Tags:iPhone iPad 开发

编辑录入:coldstar [复制链接] [打 印]
赞助商链接