|
发表于 2013-4-24 10:10:14
|
显示全部楼层
来自 中国河南郑州
bvo 发表于 2013-4-23 22:28
您是说把您的代码加到index.php头部是吗。
是否有JSP的代码呢。
另外我忘了说。我的服务器是TOMCAT7.0 ...
代码添加到页面最上面。- <%
- String uAgent=request.getHeader("User-Agent"); //得到浏览器等相关信息
- if(uAgent.indexOf("MSIE")!=-1) //这里是msie 即微软 ie浏览器
- 跳转到指定页面
- if(uAgent.indexOf("iphone")!=-1) //这里是爱疯
- 跳转到指定页面
- if(uAgent.indexOf("android")!=-1) //安卓
- 跳转到指定页面
- 后面可以加上你的其他判断
- %>
复制代码 下面是List of user agents for mobile phones
手机浏览器的user agent列表,根据你的需要z- [edit] Alcatel
- Alcatel OT-708: Alcatel-OT-708/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 ObigoInternetBrowser/Q03C
- [edit] Apple Inc.
- Apple iPhone: Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/1A542a Safari/419.3
- Apple iPhone OS 4: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7
- iPod Touch: Mozilla/5.0 (iPod; U; CPU iPhone OS 3_1_1 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Mobile/7C145
- Apple iPad: Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405
- [edit] BenQ-Siemens (Openwave)
- S68: SIE-S68/36 UP.Browser/7.1.0.e.18 (GUI) MMP/2.0 Profile/MIDP-2.0 Configuration/CLDC-1.1
- EF81: SIE-EF81/58 UP.Browser/7.0.0.1.181 (GUI) MMP/2.0 Profile/MIDP-2.0 Configuration/CLDC-1.1
- [edit] BlackBerry
- BlackBerry 7100i: BlackBerry7100i/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/103
- BlackBerry 7130e: BlackBerry7130e/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/104
- BlackBerry 7250: BlackBerry7250/4.0.0 Profile/MIDP-2.0 Configuration/CLDC-1.1
- BlackBerry 7230: BlackBerry7230/3.7.0
- BlackBerry 7520: BlackBerry7520/4.0.0 Profile/MIDP-2.0 Configuration/CLDC-1.1
- BlackBerry 7730: BlackBerry7730/3.7.0
- BlackBerry 8100: Mozilla/4.0 BlackBerry8100/4.2.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/100
- BlackBerry 8130: BlackBerry8130/4.3.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/109
- BlackBerry 8310: BlackBerry8310/4.2.2 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/121
- BlackBerry 8320: BlackBerry8320/4.3.1 Profile/MIDP-2.0 Configuration/CLDC-1.1
- BlackBerry 8700: BlackBerry8700/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/100
- BlackBerry 8703e: BlackBerry8703e/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/105
- BlackBerry 8820: BlackBerry8820/4.2.2 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/102
- BlackBerry 8830: BlackBerry8830/4.2.2 Profile/MIDP-2.0 Configuration/CLOC-1.1 VendorID/105
- BlackBerry 8900: BlackBerry8900/4.5.1.231 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/100
- BlackBerry 9000: BlackBerry9000/4.6.0.65 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/102
- BlackBerry 9530: BlackBerry9530/4.7.0.167 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/102 UP.Link/6.3.1.20.0
- BlackBerry9530/5.0.0.328 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/105
- BlackBerry 9630 Tour BlackBerry9630/4.7.1.40 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/104
- BlackBerry 9700 Bold: BlackBerry9700/5.0.0.423 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/100
- BlackBerry 9800 Torch: Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; en) AppleWebKit/534.1+ (KHTML, Like Gecko) Version/6.0.0.141 Mobile Safari/534.1
- [edit] Google
- Android SDK 1.5r3: Mozilla/5.0 (Linux; U; Android 1.5; de-; sdk Build/CUPCAKE) AppleWebkit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1
- Nexus One: Mozilla/5.0 (Linux; U; Android 2.2.1; en-us; Nexus One Build/FRG83) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
- T-Mobile G1: Mozilla/5.0 (Linux; U; Android 1.6; en-us; T-Mobile G1 Build/DMD64) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1
- [edit] HTC
- Desire: Mozilla/5.0 (Linux; U; Android 2.1-update1; fr-fr; desire_A8181 Build/ERE27) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17
- Espresso: Mozilla/5.0 (Linux; U; Android 2.1-update1; en-us; T-Mobile_Espresso Build/ERE27) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17
- EVO 4G: Mozilla/5.0 (Linux; U; Android 2.1-update1; en-us; Sprint APA9292KT Build/ERE27) AppleWebKit/530.17 (KHTML, like Gecko)
- Hero: Mozilla/5.0 (Linux; U; Android 1.5; en-za; HTC Hero Build/CUPCAKE) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1
- Legend: Mozilla/5.0 (Linux; U; Android 2.1; fr-fr; HTC Legend 1.32.163.1 Build/ERD79) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17
- Magic: Mozilla/5.0 (Linux; U; Android 1.5; en-dk; HTC Magic Build/CUPCAKE) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1
- P3450: Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 6.12) PPC; 240x320; HTC P3450; OpVer 23.116.1.611
- P3650: HTC_P3650 Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.6)
- S710: Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.6) SP; 240x320; HTC_S710/1.0 ...
- Smart: HTC_Smart_F3188 Mozilla/5.0 (like Gecko) Obigo/Q7
- Tattoo: Mozilla/5.0 (Linux; U; Android 1.6; en-us; HTC_TATTOO_A3288 Build/DRC79) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1
- 8500: HTC-8500/1.2 Mozilla/4.0 (compatible; MSIE 5.5; Windows CE; PPC; 240x320)
- 8500: HTC-8500/1.2 Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.6) UP.Link/6.3.1.17.0
- Incredible: Mozilla/5.0 (Linux; U; Android 2.2; en-us; ADR6300 Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
- [edit] LG Electronics
- LG U880: LG/U880/v1.0
- LG B2050: LG-B2050 MIC/WAP2.0 MIDP-2.0/CLDC-1.0
- LG C1100: LG-C1100 MIC/WAP2.0 MIDP-2.0/CLDC-1.0
- LG CU720: LG-CU720/V1.0|Obigo/Q05A Profile/MIDP-2.0 Configuration/CLDC-1.1
- LG CU8080: LGE-CU8080/1.0 UP.Browser/4.1.26l
- LG G1800: LG-G1800 MIC/WAP2.0 MIDP-2.0/CLDC-1.0
- LG G210: LG-G210/SW100/WAP2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0
- LG G220: LG-G220/V100/WAP2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0
- LG G232: LG-G232/V100/WAP2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0
- LG G262: LG-G262/V100/WAP2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0
- LG G5200: LG-G5200 AU/4.10
- LG G5600: LG-G5600 MIC/WAP2.0 MIDP-2.0/CLDC-1.0
- LG G610: LG-G610 V100 AU/4.10 Profile/MIDP-1.0 Configuration/CLDC-1.0
- LG G622: LG-G622/V100/WAP2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0
- LG G650: LG-G650 V100 AU/4.10 Profile/MIDP-1.0 Configuration/CLDC-1.0
- LG G660: LG-G660/V100/WAP2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0
- LG G672: LG-G672/V100/WAP2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0
- LG G682: LG-G682 /V100/WAP2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0
- LG G688: LG-G688 MIC/V100/WAP2.0 MIDP-2.0/CLDC-1.0
- LG G7000: LG-G7000 AU/4.10
- LG G7050: LG-G7050 UP.Browser/6.2.2 (GUI) MMP/1.0 Profile/MIDP-1.0 Configuration/CLDC-1.0
- LG G7100: LG-G7100 AU/4.10 Profile/MIDP-1.0 Configuration/CLDC-1.0
- LG G7200: LG-G7200 UP.Browser/6.2.2 (GUI) MMP/1.0 Profile/MIDP-1.0 Configuration/CLDC-1.0
- LG G822: LG-G822/SW100/WAP2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0
- LG G850: LG-G850 V100 UP.Browser/6.2.2 (GUI) MMP/1.0 Profile/MIDP-1.0 Configuration/CLDC-1.0
- LG G920: LG-G920/V122/WAP2.0 Profile/MIDP-1.0 Configuration/CLDC-1.0
- LG G922: LG-G922 Obigo/WAP2.0 MIDP-2.0/CLDC-1.1
- LG G932: LG-G932 UP.Browser/6.2.3(GUI)MMP/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1
- LG KP500: LG-KP500 Teleca/WAP2.0 MIDP-2.0/CLDC-1.1
- LG KS360: LG-KS360 Teleca/WAP2.0 MIDP-2.0/CLDC-1.1
- LG L1100: LG-L1100 UP.Browser/6.2.2 (GUI) MMP/1.0 Profile/MIDP-1.0 Configuration/CLDC-1.0
- LG MX8700: LGE-MX8700/1.0 UP.Browser/6.2.3.2 (GUI) MMP/2.0
- LG T5100: LG-T5100 UP.Browser/6.2.3 (GUI) MMP/1.0 Profile/MIDP-1.0 Configuration/CLDC-1.0
- LG U8120: LG/U8120/v1.0
- LG U8130: LG/U8130/v1.0
- LG U8138: LG/U8138/v2.0
- LG U8180: LG/U8180/v1.0
- LG VX9100: LGE-VX9100/1.0 UP.Browser/6.2.3.2 (GUI) MMP/2.0
复制代码 |
|