iPhone和iPad开发入门
2010-06-02 03:44:00 来源:WEB开发网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移动设备框架
- ››开发Android 日历教程
- ››开发学院总结 Win 8实用技巧大全
- ››开发学院原创教程:把win8的IE10放桌面上方法(非...
- ››iphone图片拉伸的几种方法
- ››iphone正则表达式的简单使用
- ››iPhone开发Unresolved Symbols CAKeyframeAnimati...
- ››IPhone开发-“此证书是由未知颁发机构签名”解决方...
- ››IPhone开发-整合私钥和证书,生成.p12文件
- ››iPhone应用开发-UIPickerView选取器详解
- ››iphone 获取屏幕的宽度和高度
- ››iPhone读取工程包中的二进制文件
- ››iPhone新手机 不挂YouTube APP
更多精彩
赞助商链接