百独托管7500 紫田网络超高转化播放器收cps[推荐]速盾CDN 免实名免备防屏蔽阿里云 爆款特卖9.9元封顶提升alexa、IP流量7Q5团队
【腾讯云】中小企福利专场【腾讯云】多款产品1折起高防 随时退换 好耶数据小飞国外网赚带你月入万元炎黄网络4H4G10M 99每月
香港带宽CN2/美国站群优惠中客数据中心 服务器租用联盟系统移动广告平台 中易企业专场腾讯云服务器2.5折九九数据 工信部正规资质
腾讯云新用户大礼包代金券高价收cpa注册量高价展示【腾讯云】2核2G/9.93起租服务器找45互联 随时退换阿里云 短信服务 验证秒达
123
返回列表 发新帖

[网络资源] 万能的落伍,求自动检测手机流览器访问转向到其他URL的代码。 [复制链接]
查看:7818 | 回复:21

2万

主题

11万

帖子

20万

积分

落伍者(八仙过海)

落伍管理员

Rank: 23Rank: 23Rank: 23Rank: 23Rank: 23Rank: 23Rank: 23

贡献
8888
鲜花
1138
注册时间
2009-12-23

落伍草根英雄QQ绑定落伍者落伍手机绑定

发表于 2013-4-24 10:10:14 | 显示全部楼层 来自 中国河南郑州
bvo 发表于 2013-4-23 22:28
您是说把您的代码加到index.php头部是吗。
是否有JSP的代码呢。
另外我忘了说。我的服务器是TOMCAT7.0  ...

代码添加到页面最上面。
  1. <%
  2. String uAgent=request.getHeader("User-Agent"); //得到浏览器等相关信息
  3. if(uAgent.indexOf("MSIE")!=-1)   //这里是msie 即微软 ie浏览器
  4.    跳转到指定页面
  5. if(uAgent.indexOf("iphone")!=-1)   //这里是爱疯
  6.    跳转到指定页面
  7. if(uAgent.indexOf("android")!=-1)  //安卓
  8.   跳转到指定页面
  9. 后面可以加上你的其他判断
  10. %>
复制代码
下面是List of user agents for mobile phones
手机浏览器的user agent列表,根据你的需要z
  1. [edit] Alcatel
  2. Alcatel OT-708: Alcatel-OT-708/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 ObigoInternetBrowser/Q03C
  3. [edit] Apple Inc.
  4. 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
  5. 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
  6. 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
  7. 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
  8. [edit] BenQ-Siemens (Openwave)
  9. S68: SIE-S68/36 UP.Browser/7.1.0.e.18 (GUI) MMP/2.0 Profile/MIDP-2.0 Configuration/CLDC-1.1
  10. EF81: SIE-EF81/58 UP.Browser/7.0.0.1.181 (GUI) MMP/2.0 Profile/MIDP-2.0 Configuration/CLDC-1.1
  11. [edit] BlackBerry
  12. BlackBerry 7100i: BlackBerry7100i/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/103
  13. BlackBerry 7130e: BlackBerry7130e/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/104
  14. BlackBerry 7250: BlackBerry7250/4.0.0 Profile/MIDP-2.0 Configuration/CLDC-1.1
  15. BlackBerry 7230: BlackBerry7230/3.7.0
  16. BlackBerry 7520: BlackBerry7520/4.0.0 Profile/MIDP-2.0 Configuration/CLDC-1.1
  17. BlackBerry 7730: BlackBerry7730/3.7.0
  18. BlackBerry 8100: Mozilla/4.0 BlackBerry8100/4.2.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/100
  19. BlackBerry 8130: BlackBerry8130/4.3.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/109
  20. BlackBerry 8310: BlackBerry8310/4.2.2 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/121
  21. BlackBerry 8320: BlackBerry8320/4.3.1 Profile/MIDP-2.0 Configuration/CLDC-1.1
  22. BlackBerry 8700: BlackBerry8700/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/100
  23. BlackBerry 8703e: BlackBerry8703e/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/105
  24. BlackBerry 8820: BlackBerry8820/4.2.2 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/102
  25. BlackBerry 8830: BlackBerry8830/4.2.2 Profile/MIDP-2.0 Configuration/CLOC-1.1 VendorID/105
  26. BlackBerry 8900: BlackBerry8900/4.5.1.231 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/100
  27. BlackBerry 9000: BlackBerry9000/4.6.0.65 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/102
  28. BlackBerry 9530: BlackBerry9530/4.7.0.167 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/102 UP.Link/6.3.1.20.0
  29. BlackBerry9530/5.0.0.328 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/105
  30. BlackBerry 9630 Tour BlackBerry9630/4.7.1.40 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/104
  31. BlackBerry 9700 Bold: BlackBerry9700/5.0.0.423 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/100
  32. 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
  33. [edit] Google
  34. 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
  35. 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
  36. 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
  37. [edit] HTC
  38. 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
  39. 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
  40. EVO 4G: Mozilla/5.0 (Linux; U; Android 2.1-update1; en-us; Sprint APA9292KT Build/ERE27) AppleWebKit/530.17 (KHTML, like Gecko)
  41. 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
  42. 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
  43. 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
  44. P3450: Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 6.12) PPC; 240x320; HTC P3450; OpVer 23.116.1.611
  45. P3650: HTC_P3650 Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.6)
  46. S710: Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.6) SP; 240x320; HTC_S710/1.0 ...
  47. Smart: HTC_Smart_F3188 Mozilla/5.0 (like Gecko) Obigo/Q7
  48. 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
  49. 8500: HTC-8500/1.2 Mozilla/4.0 (compatible; MSIE 5.5; Windows CE; PPC; 240x320)
  50. 8500: HTC-8500/1.2 Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.6) UP.Link/6.3.1.17.0
  51. 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
  52. [edit] LG Electronics
  53. LG U880: LG/U880/v1.0
  54. LG B2050: LG-B2050 MIC/WAP2.0 MIDP-2.0/CLDC-1.0
  55. LG C1100: LG-C1100 MIC/WAP2.0 MIDP-2.0/CLDC-1.0
  56. LG CU720: LG-CU720/V1.0|Obigo/Q05A Profile/MIDP-2.0 Configuration/CLDC-1.1
  57. LG CU8080: LGE-CU8080/1.0 UP.Browser/4.1.26l
  58. LG G1800: LG-G1800 MIC/WAP2.0 MIDP-2.0/CLDC-1.0
  59. LG G210: LG-G210/SW100/WAP2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0
  60. LG G220: LG-G220/V100/WAP2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0
  61. LG G232: LG-G232/V100/WAP2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0
  62. LG G262: LG-G262/V100/WAP2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0
  63. LG G5200: LG-G5200 AU/4.10
  64. LG G5600: LG-G5600 MIC/WAP2.0 MIDP-2.0/CLDC-1.0
  65. LG G610: LG-G610 V100 AU/4.10 Profile/MIDP-1.0 Configuration/CLDC-1.0
  66. LG G622: LG-G622/V100/WAP2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0
  67. LG G650: LG-G650 V100 AU/4.10 Profile/MIDP-1.0 Configuration/CLDC-1.0
  68. LG G660: LG-G660/V100/WAP2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0
  69. LG G672: LG-G672/V100/WAP2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0
  70. LG G682: LG-G682 /V100/WAP2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0
  71. LG G688: LG-G688 MIC/V100/WAP2.0 MIDP-2.0/CLDC-1.0
  72. LG G7000: LG-G7000 AU/4.10
  73. LG G7050: LG-G7050 UP.Browser/6.2.2 (GUI) MMP/1.0 Profile/MIDP-1.0 Configuration/CLDC-1.0
  74. LG G7100: LG-G7100 AU/4.10 Profile/MIDP-1.0 Configuration/CLDC-1.0
  75. LG G7200: LG-G7200 UP.Browser/6.2.2 (GUI) MMP/1.0 Profile/MIDP-1.0 Configuration/CLDC-1.0
  76. LG G822: LG-G822/SW100/WAP2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0
  77. LG G850: LG-G850 V100 UP.Browser/6.2.2 (GUI) MMP/1.0 Profile/MIDP-1.0 Configuration/CLDC-1.0
  78. LG G920: LG-G920/V122/WAP2.0 Profile/MIDP-1.0 Configuration/CLDC-1.0
  79. LG G922: LG-G922 Obigo/WAP2.0 MIDP-2.0/CLDC-1.1
  80. LG G932: LG-G932 UP.Browser/6.2.3(GUI)MMP/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1
  81. LG KP500: LG-KP500 Teleca/WAP2.0 MIDP-2.0/CLDC-1.1
  82. LG KS360: LG-KS360 Teleca/WAP2.0 MIDP-2.0/CLDC-1.1
  83. LG L1100: LG-L1100 UP.Browser/6.2.2 (GUI) MMP/1.0 Profile/MIDP-1.0 Configuration/CLDC-1.0
  84. LG MX8700: LGE-MX8700/1.0 UP.Browser/6.2.3.2 (GUI) MMP/2.0
  85. LG T5100: LG-T5100 UP.Browser/6.2.3 (GUI) MMP/1.0 Profile/MIDP-1.0 Configuration/CLDC-1.0
  86. LG U8120: LG/U8120/v1.0
  87. LG U8130: LG/U8130/v1.0
  88. LG U8138: LG/U8138/v2.0
  89. LG U8180: LG/U8180/v1.0
  90. LG VX9100: LGE-VX9100/1.0 UP.Browser/6.2.3.2 (GUI) MMP/2.0
复制代码
汽车轴承 www.cbs86.com
马上颂快递 马上颂快递cn
################想出现这里,PM偶!!!!!!################。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
回复

使用道具 举报

2万

主题

11万

帖子

20万

积分

落伍者(八仙过海)

落伍管理员

Rank: 23Rank: 23Rank: 23Rank: 23Rank: 23Rank: 23Rank: 23

贡献
8888
鲜花
1138
注册时间
2009-12-23

落伍草根英雄QQ绑定落伍者落伍手机绑定

发表于 2013-4-24 10:16:30 | 显示全部楼层 来自 中国河南郑州
bvo 发表于 2013-4-23 22:28
您是说把您的代码加到index.php头部是吗。
是否有JSP的代码呢。
另外我忘了说。我的服务器是TOMCAT7.0  ...

JSP代码类似,加到页面头部
  1. <%
  2. String ie=request.getHeader("User-Agent"); //得到浏览器等相关信息
  3. if(ie.indexOf("MSIE")!=-1)   //这里是msie 即微软 ie浏览器
  4.    跳转到正常的域名
  5. if(ie.indexOf("iphone")!=-1)
  6.   跳转到爱疯wap
  7. if(ie.indexOf("android")!=-1)
  8.   跳转到安卓wap
  9. 可以继续判断
  10. %>
复制代码
然后你可以搜索一下List of user agents for mobile phones,里面列有多数手机浏览器的user agent,比如LG U8130:的是LG/U8130/v1.0
型号很多,根据你的需要添加。
汽车轴承 www.cbs86.com
马上颂快递 马上颂快递cn
################想出现这里,PM偶!!!!!!################。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

论坛客服/商务合作/投诉举报:2171544 (QQ)
落伍者创建于2001/03/14,本站内容均为会员发表,并不代表落伍立场!
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论!
落伍官方微信:2030286 邮箱:(djfsys@gmail.com|tech@im286.com)
© 2001-2014

浙公网安备 33060302000191号

浙ICP备11034705号 BBS专项电子公告通信管[2010]226号

  落伍法律顾问: ITlaw-庄毅雄

手机版|找回帐号|不能发帖?|Archiver|落伍者

GMT+8, 2024-11-17 22:41 , Processed in 0.044631 second(s), 24 queries , Gzip On.

返回顶部