我做这在以前的版本我的网站,在这里写一下吧:http://arleym.com/mobile-device-detection-redirection/
基本上我有,如果有一个查询字符串将被忽略的一些设备检测。因此,“查看桌面版本”链接将避免检测/重定向并为用户提供cookie。
我用这个检测脚本:http://detectmobilebrowsers.mobi/
,并修改了我的开关,像这样:
<?php
if(isset($_GET['switch'])){
setcookie('switch',$_GET['switch']); // set a cookie
}
if(!isset($_GET['switch']) && !isset($_COOKIE['switch'])){
require_once('/server/path/arleym.com/mobile_device_detect.php'); //Andy Moore's script
mobile_device_detect(true,false,true,true,true,true,true,'
http://arley.me',false);
}
?>
View桌面网址只是做它的东西一样HREF =“http://whatever.com?switch = 0“