WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. teeli
    Member
    Posted 1 year 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']) ) {
            wp_redirect(MobileDTS::get_switch_theme_link('mobile'));
            die();
        }

    http://wordpress.org/extend/plugins/mobile-detector/

  2. teeli
    Member
    Posted 1 year 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
    Member
    Plugin Author

    Posted 1 year ago #

    Try the new version 2.0.2 and report, please!

  4. teeli
    Member
    Posted 1 year ago #

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

  5. Tubal
    Member
    Plugin Author

    Posted 1 year ago #

    Nice!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.