WP Super Cache
Mobile Version keeps switching between Mobile and Web (4 posts)

  1. bluedane
    Posted 2 years ago #


    Since installing and activating the WP Super Cache our mobile version of the site, even with Mobile Device Support, keeps switching between the mobile version and the web version.

    The frequency of when the switch happens is very inconsistent, however usually the site being shown on the mobile device when showing the web version is an older version of the site - and not the up-to-date one.

    Have anyone else experienced this problem?

    Kind Regards



  2. unholyknight
    Posted 2 years ago #

    I just had this problem as well. I found that turning off this option in the advanced tab seems to fix it:

    "Cache rebuild. Serve a supercache file to anonymous users while a new file is being generated. (Recommended)"

    I haven't seen an issue with mobile and desktop caches being served to the wrong browsers in the 12 hours since I disabled that option.

  3. unholyknight
    Posted 2 years ago #

    It looks like that didn't fix the issue. I'm certain it is happening less often with that option disabled, but I've run several preload tests and each time the preloaded cache pages are all generated and served correctly.

    The site I'm having this issue on is light on content so I have a complete cache preload scheduled every 4 hours. That may be a viable workaround for the time being unless you have 100s of pages that the system will be caching each time preload runs.

  4. unholyknight
    Posted 2 years ago #

    Sitting back and thinking about the problem I think I've identified my issue. I'm using Serban Ghita's Mobile Detection function, which is very up-to-date and all encompassing.

    The mobile detection within WP Super Cache isn't as complete as my separate mobile detection library is so when a mobile user comes along that WP Super Cache doesn't ID as a mobile user it goes to cache a desktop version of the page, but my theme identifies that user as a mobile user and WP Super Cache then caches the mobile version of the page as if it were the desktop version. As far as it knows that user was a desktop user.

    For the time being I removed the mobile detection function I was using within my theme and replaced it with the detection function that is used in WordPress Mobile Edition since WP Super Cache is using an identical scheme to identify, build and serve cached files.

    The function within your theme that handles theme switching to desktop (if that's what you're using - it's how I'm accomplishing this) should match WP Super Cache's for the best behavior possible. You can see the function I'm using at http://pastie.org/6098853

    Just change INSERT_YOUR_THEME_NAME_HERE to the name of your mobile-specific theme.

    This is just a fix for the time being - when I have more time I'd like to tie in Serban Ghita's Mobile Detection function as it's more up to date, but this eliminates the miscaching for the time being.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Super Cache
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic