Determine Android IOS

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.