Support » Requests and Feedback » Proposal: Server Side Responsive, Caching, User Agent Detection (in the core)

  • Hi,

    I’m playing with responsive blogs those days and even if media queries and javascript can resolve most of the problems, sometimes a server side action can improve the performances of the site sending back only what a phone need (and not everything then partially hidden with media queries).

    To do that a “phone” detection must be in place. I don’t use the word “mobile”, since the tablets are considered mobile but most of the times a tablet is like a desktop and does not need too much changes on served pages.

    Where the problems lie? Different systems (plugins, caching, themes) have different method to detect a “phone” and they must be kept aligned.

    Specially caches (I’m the author of Hyper Cache and Lite Cache) must be able to separate the pages for phones and desktops (when different) and so should be able to distinguish the UA in the same way as the theme or installed plugins.

    My proposal (it’s an example not a specification!): WordPress should have a function is_phone() declared BEFORE the cache activation (when the advanced-cache.php file is loaded). By default this function can be not implemented and return always false.

    Then it should allow a drop-in plugins that override the function with specific user agent detection, for example with a wp-content/advanced-detection.php file.

    Being a core function, every piece of code can use it, even the advanced-cache.php which starts BEFORE plugins are loaded (this is way caches cannot really benefit of plugins which do the user agent detection).

    Instead of the is_phone() function, an wp_get_ua_type() can be defined with some predefined ua types (like did by bootstrap with has the tablet, desktop and phone ua).

    Thank you, Stefano.

  • The topic ‘Proposal: Server Side Responsive, Caching, User Agent Detection (in the core)’ is closed to new replies.