Themes seem to cache mobile_detect the first time a page is loaded

Permalink
I am using some code from Zen Cart to give my concrete5 V8.5.2 website the same look and feel as my eCommerce shop. I have added the following code to the default.php and full.php for the themes template. After clearing the cache in concrete5 the first time a page is loaded correctly with regard to the mobile, tablet, and responsive CSS. If that same page is accessed by another user on another device, the page is always being served as how it was the first time until cache in concrete5 is cleared. I have tried to turn cache off, but that has not helped. If you have experienced this issue, please advise on how you have corrected.

<!DOCTYPE html>
<html dir="ltr" lang="en">
    <head>
        <?php 
        Loader::element('header_required');
        Loader::library('3rdparty/mobile_detect');
        $detect = new Mobile_Detect();
        ?>       
...
<?php
// ZCAdditions.com, ZCA Responsive Template Default (BOF-addition 2 of 2)
$responsive_mobile = '<link rel="stylesheet" type="text/css" href="/shop/includes/templates/mythemename/css/responsive_mobile.css' . '" /><link rel="stylesheet" type="text/css" href="/shop/includes/templates/mythemename/css/jquery.mmenu.all.css' . '" />';
$responsive_tablet = '<link rel="stylesheet" type="text/css" href="/shop/includes/templates/mythemename/css/responsive_tablet.css' . '" /><link rel="stylesheet" type="text/css" href="/shop/includes/templates/mythemename/css/jquery.mmenu.all.css' . '" />';
$responsive_default = '<link rel="stylesheet" type="text/css" href="/shop/includes/templates/mythemename/css/responsive_default.css' . '" /><link rel="stylesheet" type="text/css" href="/shop/includes/templates/mythemename/css/jquery.mmenu.all.css' . '" />';
if (in_array($current_page_base, explode(",", 'popup_image,popup_image_additional'))) {