如何检查浏览我的网站的用户是否使用iPhone,然后将用户重定向到另一个URL?
像这样:
if(Request.UserAgent.IndexOf("iPhone") > 0)
Response.Redirect("~/iPhone/");
Run Code Online (Sandbox Code Playgroud)
iPhone的用户代理是
Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3
| 归档时间: |
|
| 查看次数: |
1464 次 |
| 最近记录: |