1. JS Judgment Client
<script language="JavaScript"> <!--onload=function Browserredirect () {//platforms, devices, and operating systems varsystem ={win:false, Mac:false, XLL:false, iphone:false }; //Testing Platform varp =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); //Jump Statement if(system.iphone) {alert ("iphone Access"); } Else if(System.win | | system.mac | |system.xll) {alert ("PC Access"); } Else{alert ("Non-PC access"); } }; // -</script>
2, asp.net/c# determine the client type
stringStr_u = request.servervariables["http_user_agent"]; if(Str_u.tolower (). IndexOf ("Windows") >0) {Response.Write ("PC Access <br>"); } if(Str_u.tolower (). IndexOf ("iphone") >0) {Response.Write ("iphone Access <br>"); } if(Str_u.tolower (). IndexOf ("Android") >0) {Response.Write ("Android Access <br>"); }