Mobile Detector
[resolved] Strange behaviour when using Mobile Detector (5 posts)

  1. teeli
    Posted 2 years ago #

    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']) ) {


  2. teeli
    Posted 2 years ago #

    Apparently the problem is that the plugin does not explicitly define the cookie's path, so it creates multiple wp_mobiledts_theme cookies for different paths under the website.

  3. Tubal
    Plugin Author

    Posted 2 years ago #

    Try the new version 2.0.2 and report, please!

  4. teeli
    Posted 2 years ago #

    After a quick test, it seems to be working now. Thanks!

  5. Tubal
    Plugin Author

    Posted 2 years ago #


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Mobile Detector
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.