• mrboats

    (@wpseiskaadmin)


    Hi,

    Now with some more traffic on the plugin, it seems that the way your plugin handles mobile vs desktop gets cached. This means that for a given page, if the first user after cache clean is mobile, then everyone gets the bar and if the first user is desktop then mobile users do not get the bar.

    So the setting “mobile desktop both” does not really seem to work when a cache plugin is used if you want to choose one or the other and not both.

    I use a very simple cache module called Cache enabler in case you need to test. A short term workaround would be to (re)introduce the setting for max width, but the problem with that was that then the bar appeared on small desktop screens as well.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Anna Bansaghi

    (@annabansaghi)

    Thank you for the notice.

    The plugin uses wp_is_mobile function to checking the user’s device. I need to do some googling on how can I avoid caching in this specific case.

    Plugin Author Anna Bansaghi

    (@annabansaghi)

    I made an exhaustive search on this topic, and it seems to me that the MCB plugin is not responsible for that.

    That is what I understand. You need two different cache versions of your site – for desktop and mobile devices. A cache plugin should choose between these versions according to the user’s device.

    References

    https://community.rtcamp.com/t/nginx-fastcgi-cache-and-wordpress-wp-is-mobile-function-not-showing-correct-page-versions-to-correct-user-devices/3958

    https://alpine.link/wordpress/wordpress-page-caching-mobile-users/

    https://community.rtcamp.com/t/fastcgi-cache-mobile-theme-purge/1558/7

    Thread Starter mrboats

    (@wpseiskaadmin)

    Hi,

    Thanks for the update. I’ll have to look at the mobile caching stuff then I guess.

    As a hint to other with the same problem. I have made a temporary workaround with CSS and setting the bar to “Both”:

    @media screen and (orientation: landscape) {
    #mobile-contact-bar{
    display:none;
    }
    }

    This pretty much disables it on all computers. You could fine tune also for display on tabs held in landscape mode with some more rules.

    Thread Starter mrboats

    (@wpseiskaadmin)

    An other option might be to use some jscript, something like this (not tested but as an idea to others having the same prob):

    if( navigator.userAgent.match(/Android/i)
    || navigator.userAgent.match(/webOS/i)
    || navigator.userAgent.match(/iPhone/i)
    || navigator.userAgent.match(/iPad/i)
    || navigator.userAgent.match(/iPod/i)
    || navigator.userAgent.match(/BlackBerry/i)
    || navigator.userAgent.match(/Windows Phone/i)
    ){
    jQuery(“#mobile-contact-bar”).remove();
    }

    Plugin Author Anna Bansaghi

    (@annabansaghi)

    Thank you for these hints.

    Reconsidered, and it looks better if MCB will provide an option for choosing between the rendering methods:

    1. CSS media queries – as it was till v1.4.1
    2. PHP wp_is_mobile() – as it is now from v2.0.0

    Each one has its own drawbacks and advantages.

    What do you think?

    Thread Starter mrboats

    (@wpseiskaadmin)

    Those are certainly valid options and good usability to let the admin choose the most appropriate alternative. I’m rooting a bit for a jscript solution, I’ll make up my mind if I can make that one work ??

    Plugin Author Anna Bansaghi

    (@annabansaghi)

    Perfect! ??

    Updated list:

    • CSS media queries
    • PHP user agent detection with wp_is_mobile()
    • JavaScript user agent detection with a custom function
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Mobile vs desktop setting seems to be cached’ is closed to new replies.