Idea: Different mobile and desktop caches
-
Hey there,
First of all – great plugin, you guys rock ??
Recently I’ve run into a problem with full page cache. It’s not the FFPC specific, but might be important. Here’s the idea:
If you want to make your site truly mobile-friendly (and you really should) you should never limit yourself with only responsive media-queries and hiding some ‘desktop-only’ parts using
display: none;
in CSS. You should avoid loading that ‘desktop-only’ parts in the first place. Prevent large desktop js-libraries from loading etc.WordPress gives us a handy conditional function
wp_is_mobile()
. With it you can conditionally load some parts on desktop and prevent them from loading on mobile. You can alter your html, or even target different js logics if you add ‘is_mobile’ / ‘is_not_mobile’ to body classes (or any other component).But with full page cache it’s not working. If you’re pre-caching your site, all users will get the desktop version. If you don’t pre-cache, all users will be served with a same version (desktop or mobile) which was generated on a first request, depending on what type of device was used. Total mess.
So what I think. Optionally, we can generate 2 sets of cache files – desktop and mobile. On the Nginx side, we can detect mobile/desktop and serve proper page (See https://gist.github.com/perusio/1326701 for sample mobile detection). It looks like it’s not a lot of work to do, but definitely a game change.
What do you think? If you like the idea, I would be happy to help.
- The topic ‘Idea: Different mobile and desktop caches’ is closed to new replies.