Load desktop site for tablet, not mobile which is the default

Permalink
I have a desktop, and mobile version of a website. By default, the mobile theme is loaded for tablets (iPad, etc.). I would like to modify that so the desktop theme is displayed for tablets.

I was able to find documentation for older versions of C5, but I believe the source code has changed in version 5.6.3.3

Any help would be much appreciated.

Thanks!

jlines41
View Replies: View Best Answer
AndyJ replied on at Permalink Reply
hi,
this very much depends on your theme. Does it use a framework? It sounds as though it might be using media queries and maybe only showing the desktop site when the viewport width is greater than 1024px (complete supposition on my part).

Viewing the site in chrome can help with this and using the developer tools to change the device view (the little mobile icon st the far left of the toolbar that allows you to change the viewport to preconfigured devices / orientations). You can change the viewport then look straight to the code panel in the right which shows you exactly which styles are in play.
jlines41 replied on at Permalink Reply
jlines41
Hi Andy,

Thanks for your reply. The site uses bootstrap. I have some complex nav features and I have a dedicated mobile theme selected through the concrete 5 dashboard. I suspect the needed change is somewhere in this directory: libraries/3rdparty/mobile_detect.php

I have found documentation in the forums that provide a solution for older versions, but looking at the code in 5.6.3.3, I can see that it has changed. I'm hoping a php guru can tell me what line needs to be modified.
juddc replied on at Permalink Reply
juddc
I wish I could remember - I had to do this once, but mobile_detect.php has changed since I did. I can tell you that mobile_detect.php is the key. You might try contacting the guys athttp://mobiledetect.net or Stackoverflow.
jlines41 replied on at Permalink Reply
jlines41
Thanks duddc. I wasn't aware that script was from a third party vendor. I will check out their documentation.
jlines41 replied on at Permalink Best Answer Reply
jlines41
Ok so I have a solution. Wrap all of the code found on: concrete/libraries/3rdpartymobile_detect.php with this:

<?php
// Check for any mobile device, excluding tablets.
if ($detect->isMobile() && !$detect->isTablet()) {
// ALL OF THE CODE ON THE PAGE
}

So the first chunk goes on at the top of the page above everything, and the closing bracket goes at the bottom after everything. This will omit tablets all together.