Strange behaviour when using Mobile Detector
-
I’m experiencing some strange behaviour when using Mobile Detector. I’ve made my own mobile theme and both, desktop and mobile themes, have buttons to switch to each other. If a user for example goes to contact page and switches from mobile to desktop, the contact page is correctly shown as desktop. The next page will still be shown as mobile page however, but every time the user returns to the contact page, the desktop version is shown. So it seems that the theme settings is somehow page specific instead of site specific. This leads to some very confusing results where the theme is switched seemingly arbitrarily between page loads.
I have my own detection script for URLs starting with “m.”, but I don’t see how this could be messing with the detection:
if( preg_match( '/^m\.(.*)$/im', $_SERVER['HTTP_HOST'] ) && class_exists( 'MobileDTS' ) && !MobileDTS::is_mobile_theme() && !isset($_COOKIE['wp_mobiledts_theme']) ) { wp_redirect(MobileDTS::get_switch_theme_link('mobile')); die(); }
https://www.ads-software.com/extend/plugins/mobile-detector/
- The topic ‘Strange behaviour when using Mobile Detector’ is closed to new replies.