如何仅在设备上显示响应式网站视图

时间:2014-01-17 14:28:42

标签: html5 css3 responsive-design web-deployment

我有一个网站。它现在没有响应。通常我们可以通过缩小浏览器大小来检查任何响应式网站,如果是css3媒体查询。但我想为我的网站制作一个响应式视图。当用户通过PC访问该站点时,他们可以看到PC版本。如果他们减少浏览器大小,他们将无法看到移动视图。如果移动视图仅在移动设备上访问,他们将能够看到移动视图。

例如:

http://www.whatsapp.com

http://www.facebook.com

1 个答案:

答案 0 :(得分:0)

使用php-mobile-detect,您可以检测用户浏览器并将移动设备重定向到m.whatsapp.com。这是你在找什么?

Example:

require_once '../Mobile_Detect.php';
$detect = new Mobile_Detect;
if($detect->isMobile() || ($detect->isTablet()){
    // Redirect to the mobile version instead of the desktop version
    header('Location: m.yoursite.com');
}
相关问题