Php
Strpos ($_server[' http_user_agent '), ' IPhone ') iPad
if (strpos($_server[' http_user_agent '], ' IPhone ') | | Strpos ($_server[' http_user_agent '], ' iPad ') { }Elseif(strpos($_server[' http_user_agent '], ' Android ') { } Else { echo ' systerm is Other ';}
Js
Navigator Object
Navigator.appname return Browser name
Navigator.appversion back to browser platform and version information
Navigator.useragent returns information about the User-agent header sent by the client to the server
Reference http://www.cnblogs.com/dudumao/p/4201287.html
<!DOCTYPE HTML><HTMLLang= "ZH-CN"><Head> <MetaCharSet= "UTF-8"> <title>Mobile app download page: Based on terminal & channel identification</title> <Scripttype= "Text/javascript"> //get information about a terminal varTerminal= { //identify mobile terminal typesPlatform:function(){ varu=navigator.useragent, App=navigator.appversion; return { //Android Terminal or UC browserAndroid:u.indexof ('Android') > -1 ||U.indexof ('Linux') > -1, //whether it's an iphone or Qqhd browserIphone:u.indexof ('IPhone') > -1 , //whether ipadIpad:u.indexof ('IPad') > -1 }; }(), //identify the language of the mobile Terminal: ZH-CN, en-US, KO-KR, JA-JP ...language: (Navigator.browserlanguage||navigator.language). toLowerCase ()}//If you want to split channels, it is also possible, channel differentiation:? from=xx var from= (function(){ varSearchInfo=Location.search.substr (1). Split ('&'), Item,from; for(varI= 0, Len=Searchinfo.length;len> 1 &&I<Len;i++) {Item=Searchinfo[i].split ('='); if(item[0] == ' from') { from=item[1]; Break; } } returnFrom ; })(); //jump to a different address, depending on the terminal vartheURL= 'http://www.XXX.com'; //Android System App if(Terminal.platform.android) {//here differentiates the channel Switch(from) { Case 'Baidu': theURL= 'your App:baidu custom version'; Break; Case 'Google': theURL= 'your App:google custom version'; Break; default: theURL= 'your app: the official version'}} location.href=theURL; </Script></Head><Body> <!-- -</Body></HTML>
Determine Android IOS