The first method:
<script> If(navigator.platform.indexOf ('Win32')!=-1 ) { //pc //window.location.href= "Computer url"; }else{ // Shouji Window.location.href=" mobile URL "; </script>
The second method:
<script type="Text/javascript">function Browserredirect () {varSuseragent=navigator.userAgent.toLowerCase ();varbisipad= Suseragent.match (/ipad/i) = ="ipad"; varbisiphoneos= Suseragent.match (/iphone os/i) = ="iphone OS"; varbismidp= Suseragent.match (/midp/i) = ="MIDP"; varBisuc7= Suseragent.match (/RV:1.2.3.4/i) = ="rv:1.2.3.4"; varbisuc= Suseragent.match (/ucweb/i) = ="UCWeb"; varBisandroid= Suseragent.match (/android/i) = ="Android"; varBisce= Suseragent.match (/windows ce/i) = ="Windows CE"; varbiswm= Suseragent.match (/windows mobile/i) = ="Windows Mobile"; if(Bisipad | | bisiphoneos | | bismidp | | bIsUc7 | | bisuc | | bisandroid | | bisce | |biswm) {Window.location.href='Mobile Website Address'; } Else{window.location='Computer website Address'; } } browserredirect (); </script>
The third method:
<script type="Text/javascript">varMobileagent =NewArray ("iphone","ipod","ipad","Android","Mobile","BlackBerry","webOS","Incognito","webmate","Bada","Nokia","LG","UCWeb","Skyfire");varBrowser =navigator.userAgent.toLowerCase ();varIsMobile =false; for(varI=0; i<mobileagent.length; i++) {if(Browser.indexof (Mobileagent[i])!=-1) {IsMobile =true; //alert (mobileagent[i]);Location.href='Mobile URL'; Break; } } </script>
The fourth method:
<?PHP////This part of the cell phone stationHeader ("Cache-control:no-cache"); Header ("Pragma:no-cache"); $ua= Strtolower ($_server['http_user_agent']); $uachar="/(symbianos|android| Mac os|ucweb|blackberry) /I";if($ua! ="'&&!Preg_match ($uachar, $ua)) {echo'window.location.href= "Computer address";'; exit ();}? ><?PHP//This section is on the website.Header ("Cache-control:no-cache"); Header ("Pragma:no-cache"); $ua= Strtolower ($_server['http_user_agent']); $uachar="/(symbianos|android| Mac os|ucweb|blackberry) /I";if($ua! ="'&&Preg_match ($uachar, $ua)) {echo'window.location.href= "mobile address";'; exit ();}?>
The Fifth method:
<?phpfunction useragent () {$user _agent= (!isset ($_server['http_user_agent'])) ? FALSE: $_server['http_user_agent']; return$user _agent;}//Mobileif((Preg_match ("/(iphone|ipod|android)/ I", Strtolower (UserAgent ()))) and Strstr (Strtolower (useragent ()),'WebKit') {header ('Location : Mobile URL'); Exit;}Else if(Trim (useragent ()) = ="'OR Preg_match ("/(Nokia|sony|ericsson|mot|htc|samsung|sgh|lg|philips|lenovo|ucweb|opera mobi|windows mobile|blackberry)/I ", Strtolower (useragent ()))) {Header ('Location : Mobile URL'); Exit;}Else{//PCHeader ("Location : Computer URL");}?>
The sixth method, can also be named Uaredirect file download to their own website to introduce;
(Note: Put Uaredirect in Baidu Search will appear file specific address)
Description: Personal advice is to use the method provided by Baidu, simple, convenient, on the website open Speed impact small
Using JS to determine the mobile phone access to jump to the mobile station