The mobile phone access site automatically jumps to the mobile version
now many websites have already appeared on the mobile version of the website, and the mobile website is updated synchronously with the web site. Most people visit our website directly to access the domain name on the computer. It is impossible to remember a domain name for the mobile site. All of us know that the Chinese are lazy, so the Chinese people are more lazy. To this situation, how we face, in fact, the method is very simple is to add a sentence in the head of the website, judging is the mobile phone access to the mobile phone page automatically, if it is a computer access to show the normal version of the.
code as follows:
[code].lt; script src=.quot; http://siteapp.baidu.com/static/webappservice/uaredirect.js.quot; type=.quot; text/javascript.quot;.Gt;.Lt; /script.gt; your mobile phone website; Br / > this is a jump by using Baidu APP application.
> -- m -->http://jingyan.baidu.com/article/cdddd4... 0e198.html
//pc
window.location.href=.quot; the computer URL.Quot;
}else{
//shouji
window.location.href=.quot; >function browserRedirect () {
var sUserAgent= navigator.userAgent.toLowerCase ();
var bIsIpad= sUserAgent.match (/ipad/i) = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
var sUserAgent= navigator.userAgent.toLowerCase ();
var bIsIpad= sUserAgent.match (/ipad/i) =.Quot;
var bIsUc7= sUserAgent.match (/rv:1.2.3.4/i) = =.Quot; rv:1.2.3.4.quot;
var bIsUc= sUserAgent.match (/ucweb/i) = =; >var bIsWM= sUserAgent.match = =.Quot; windows mobile.quot;
if.
browserRedirect ();
.lt; /script.gt; [/code]
4
[code].lt; script type=.quot; T;.Quot; incognito.quot;.Quot; webmate.quot;.Quot; bada.quot;.Quot; nokia.quot;.Quot; lg.quot;.Quot. LeAgent.#91 = =-1) {isMobile = true;
//alert (mobileAgent.#91; i.#93;);
location.href = 'cell phone URL'; />header (.Quot; Pragma: no-cache.quot;);
$ua = strtolower ($_SERVER.#91;'HTTP_USER_AGENT'.#93;);
$uachar =.Quot; It ();
}
.Gt;
.lt; php
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
if ($ua! = ''.Amp;.Amp; preg_match ($uachar, $ua)) {
echo'window.location.href=.quot; ) FALSE: $_SERVER.#91;'HTTP_USER_AGENT'.#93;
return $user_agent;
}
//Mobile
if.) Se if (trim (UserAgent ()) = = 'OR preg_match (.Quot; / nokia|sony|ericsson|mot|htc|samsung|sgh|lg|philips|lenovo|ucweb|opera mobi|windows mobile|blackberry) /i.quot; Brain web site.Quot;);
}
?.gt; [/code]