标签:android style blog http color java io for
1、js 判断客户端
<script language="JavaScript"> <!-- onload = function browserRedirect() { //平台、设备和操作系统 var system = { win: false, mac: false, xll: false, iphone: false }; //检测平台 var p = navigator.platform; system.iphone = p.indexOf("iPhone") == 0; system.win = p.indexOf("Win") == 0; system.mac = p.indexOf("Mac") == 0; system.x11 = (p == "X11") || (p.indexOf("Linux") == 0); //跳转语句 if (system.iphone) { alert("iPhone访问"); } else if (system.win || system.mac || system.xll) { alert("PC访问"); } else { alert("非PC访问"); } }; //--> </script>
2、asp.net/C#判断客户端类型
string str_u = Request.ServerVariables["HTTP_USER_AGENT"]; if (str_u.ToLower().IndexOf("windows") > 0) { Response.Write("PC访问<br>"); } if (str_u.ToLower().IndexOf("iphone") > 0) { Response.Write("iPhone访问<br>"); } if (str_u.ToLower().IndexOf("android") > 0) { Response.Write("android访问<br>"); }
js 判断客户端 和 asp.net/C#判断客户端类型,布布扣,bubuko.com
标签:android style blog http color java io for
原文地址:http://www.cnblogs.com/chenghu/p/3919707.html