Hey guys, I am trying to use kirby for a new project that I am working on. And so far everything works just fine. (loving it btw)
But I am stuck (it is probably simple, but I don’t know how to do it):
How would you redirect the user if he is on a mobile device? For bandwidth purposes I want to separate the desktop and mobile versions, as there will be a lot more content for the desktop version.
it could be done using a css with mediaqueries which hides anchor links to desktop version and shows (hidden on desktop) those linking to mobile version.
If you use the mobile detect library suggested by @malvese, all you need to do is out the Mobile_Detect.php file into your plugins folder. Then it is automatically loaded and you can use it anywhere, following the documentation, e.g.
<?php
$detect = new Mobile_Detect;
if ($detect->isMobile()) {
echo "I'm a mobile device";
}
?>