WP Super Cache (WSC) supports mobile devices but it is a headache to make it work properly.
In my case, I use WPTouch. It appears that when WSC detects a mobile device, it will pass the request to WPTouch to render it and saves the content in index-mobile.html file. When another mobile user comes, the index-mobile.html will be served to the user.
Problem arises if users want to switch the WPTouch to view the full site. WPTouch includes a mode switcher in the footer. The problem is even if the user is able to switch it to the full site, WSC saves that full site as index-mobile.html. When next mobile visitor comes, he/she is served with the cached full site that is saved in index-mobile.html!!
Unless you want to disable the mobile/normal mode switch in WPTouch, which is not a good idea, mobile users will be shown with inconsistent content formats.
The only way to fix this seems to be disable caching for mobile users all together. However this cannot not done by turning off mobile user support in WSC. Doing so will make WPTouch useless.
I’d like to suggest the plugin author to add an option to not cache at all for mobile users but makes sure WSC hands off to WPTouch nicely.
That’s a good idea, but a better way would be for WP Super Cache to somehow recognise the desktop switch and then serve the ordinary cached pages. I’ll see what I can do but there are only so many hours in the day ..
It may not be too difficult. The key is to prepare two different versions for mobile users: one is the small screen version and another is full version. You cannot simply serve the full site cache for desktop browsers because the full version generated by WPTouch has a mode switcher in the footer while the regular one does not.
Currently I have found a workaround to get the mode switch to work: I added “wptouch” to the cookie list that is used to detect known users. However this means no caching. This is also somewhat consistent with my original suggestion. But I agree a better solution is to have WSC work better with WPTouch.
I added code to the dev version that checks for the wptouch_switch_toggle cookie. Check wp_super_cache_wptouch_cookie_check() in plugin/wptouch.php in http://downloads.wordpress.org/plugin/wp-super-cache.zip for usage.
I haven’t tested this so feedback would be appreciated!
Thanks for this fix as well! I’m the one with the post going here:
Don’t want to cross post here so please feel free to respond at the above post, but I assume that this update includes the same fixes that are in the dev version that you suggested in the other post?
You’ll notice that my response there mentions that I too use WPTouch!
the new WP Super Cache (1.1) seems to be caching the mobile version provided by latest WPTouch Pro (2.7).
However the switching of mobile site to desktop doesn’t work. I found the above post about the new WPTouch plugin which you created for WP Super Cache posted above.
It’s not helping. As soon as I activate that plugin, my computer gets the mobile version, same as my smartphone. I use “Use PHP to serve cache files” and “Mobile device support”.
The cookie set by WPTouch Pro is “wptouch-pro-view”, but in your plugin I’m seeing “wptouch_switch_toggle”. I’m not sure if that’s the reason, but it’s weird.
Or do we need to program around the wp_super_cache_wptouch_cookie_check() function? I think this should work out of the box.
i have the latest super cache (1.1) and latest wptouch (1.9.41)
and they dont work together (previously they did, prev version for wsc and prev version for wptouch) when i access the site through mobile device i see the desktop version.
is there some setting to make this work?
FolioVision – ah, you’d be using the Pro version of WPTouch then?
yes, we use the Pro version. Will changing the Cookie name fix the issue? Do you have experience with that? We can try that out and let you know.
Ah ha, no, I can put a check for that in the plugin. I presume when you switch to desktop view that cookie’s value is “normal”?
actually – it’s “desktop”. It’s not very good that there are such differences between versions of the same plugin (WPTouch Pro/WPTouch).
OK, so I found WPTouch Pro on someone’s svn directory for their website (oops) and figured out that it sets that cookie to “desktop”.
I updated the wptouch plugin in wpsc. You can grab it here. Copy that file into wp-content/plugins/wp-super-cache/plugins/ where it should overwrite the file already there.
If you can wait 20 minutes, try the development version. More details here: http://ocaoimh.ie/y/2o
thank you for your reply and quick action.
I’m sorry, but the fix does not help, it’s still the same as described above: http://wordpress.org/support/topic/wp-super-cache-and-wptouch?replies=12#post-2865032
I noticed that the check for Cookie was changed in one place, but not in the other (in the wp_super_cache_wptouch_cookie_check function).
Handling the proper cookie is one thing, but there is still the problem with the mobile version caching as desktop version when the WPTouch plugin for WP Super Cache in activated. There is no cookie stored until you switch from mobile to desktop version.
OK, I updated the wptouch.php again if you’d like to try it. Hopefully that will fix the caching of the mobile client.
sorry about my delayed reply here.
I tested your latest fix. As soon as the WP Super Cache WP Touch plugin is turned on and you visit a page on mobile, the main cache file for the page gets the mobile version. So visiting it again on PC shows the mobile site.
I only did a quick check to see if I can figure this out and I:
1. Figured out it’s not any of these action
add_cacheaction( 'wp_super_cache_mobile_browsers', 'wp_super_cache_wptouch_browsers' ); add_cacheaction( 'wp_super_cache_mobile_prefixes', 'wp_super_cache_wptouch_prefixes' ); add_cacheaction( 'wp_cache_check_mobile', 'wp_super_cache_wptouch_cookie_check' );
2. Figured out that .htaccess has no effect on mobile caching if you are using mod_rewrite caching. It seems that all of it is going through PHP. Please correct me if I’m wrong.
I noticed that my mobile website (viewed on iPhone4) would not toggle to desktop version. Link to my website I haven’t tested the mobile on/off in a month or two, so not sure when this change occurred (maybe during a plugin or WP update?)
I have the most updated version of WordPress and both plugins active and updated: WPTouch and WP Super Cache
My goal: Enable the mobile site on/off button so mobile users can see the desktop version.
I have now done something or a few things that have totally hidden my site on mobile and desktop. Zero content shows up. I think this is due to me changing settings in the cache plugin. Hoping you can help:
Before I go through all my steps, I want to know if a quick fix might be to reset WP Super Cache to default settings? Could that mess anything up?
I think the problem maybe related to the home page/static page in WPTouch settings. I had home set to none specified and posts page set to Marketing. I changed home to Home and then to marketing during my tests but neither helped.***
Steps I took:
1. I went into my WPTouch plugin settings. I noticed that WPTouch was “disabled”) but that my mobile site was displaying fine. Since it seemed like it could help get the toggle on/off working, I changed it to “enabled” and saved. I also changed the WPTouch mobile settings from the previous to display
Note that I do not have the colors like blue, green, I just have the one mobile theme.
Appearance –> Mobile Theme
Clicked on link at top to switcher settings page. Got this message: You do not have sufficient permissions to access this page.
Edited the other configurations that I could:
Had Enable Nokia templates already checked.
Check mobile status: launched ready.mobi and got a score of 2
Show home link in menu: this was checked. I unchecked (unselected) it. “Unselect this if you are using a dedicated page for the blog home. It prevents ‘Home’ appearing twice in the menu.” (***This might be part of the problem? I now want to display all my posts from all categories. I had previously been showing just Marketing category posts.)
Kept other settings same:
List of posts to show: show title and teaser for all posts
Yes (checked) display metadata for posts.
Teaser length 50
Number of widget items: 5
I saved changes.
I think it was at this point when my mobile website showed no content.
2. I looked up support forums which said that if you have WPTouch and WP Super Cache, be sure to set the caching plugin to allow for the WPTouch mobile site to cache.
WP Super Cache Settings
Caching was already on
Box already checked: Caching hits to website for quick access
Box checked: Use PHP to serve cache files
The only other boxes checked were:
I went to Advanced section and checked Mobile device support (it wasn’t before).
These were listed:
Android, CUPCAKE, Googlebot-Mobile, bada, blackberry 9800, blackberry9500, blackberry9520, blackberry9530, blackberry9550, dream, iPhone, iPod, incognito, s8000, webOS, webmate
No more boxes checked.
Expiry Time & Garbage Collection
Cache timeout: 3600 seconds
Scheduler: Timer: 3600 seconds
Lock Down: Disabled
CDN: did not modify this section. “Enable CDN Support” is not checked.
Contents: Did not modify section.
3 cached pages
0 expired pages
This section I did make a change. I never had touched it before.
Refresh preloaded cache files every 0 minutes. (left this at 0).
I check the box for Preload mode (garbage collection only on legacy cache files. Recommended.)
Everything was disabled. I changed WPTouch to Enabled and saved.’
Did nothing here. It is not enabled.
I would really appreciate your help — thanks in advance.
- The topic ‘WP Super Cache and WPTouch’ is closed to new replies.