I also have a problem with cache and header snippet involving Mobile Detect plugin. After activating the Kirby’s file cache I noticed, that I can only see either mobile or desktop content. This seemingly depends on which content was cached first. I have a navigation element placed in the header that has slightly different content in mobile and desktop. However, also other mobile/desktop specific content, placed elsewhere on the page, does the same thing. Is there a way to fix this issue in my case or is my problem a different case altogether?
The Mobile Detect bit in my header snippet looks like this:
</head> <body>
<?php if(!detect()->isMobile() || detect()->isTablet()): ?> <?php snippet('navigation-desktop') ?> <?php endif ?>
<?php if(detect()->isMobile()): ?> <?php snippet('navigation-mobile') ?> <?php endif ?>
The version of Mobile Detect is the one suggested in this Kirby forum post.