WordPress.org

Forums

Stadardized device detection (4 posts)

  1. Stefano Lissa
    Member
    Posted 11 months ago #

    Hi,

    many plugin, even my Hyper Cache and others, need to detected the device type (looking at the user agent) to serve different content or to chenage their behavior.

    It's complicated to maintain detection rule on every plugin and the device detection is very important, not everything can be resolved with media queries.

    My suggestion is to introduce a drop-in mechanism to let a plugin (like done by caching plugin) to detect the device and store its result in a global variable (or where is better to store it) so other plugin can rely on that information in a standard an uniform way. Of course the detection can provide a structured information: type and sub-type or like.

    That dropin must work before the advanced-cache.php drop in since even that code may need to know the agent type to look into the correct cache area.

    Stefano Lissa.

  2. Andrew
    Forum moderator & snail smusher
    Posted 11 months ago #

    Have you tried using Modernizr instead? The better way to go about it is to do feature-detection and keep the ambiguity of the device. You don't want to start tying down functionality to devices.

  3. Andrew
    Forum moderator & snail smusher
    Posted 11 months ago #

    E.g. To target old browsers like IE7 you could check to see whether the browser supports Media Queries:

    Modernizr.mq('only all'); // true if MQ are supported, false if not

    http://modernizr.com/docs/#mq
    (JavaScript)

  4. Stefano Lissa
    Member
    Posted 11 months ago #

    The is device capability detection at client side, what I need is a uniform detection at the server side.

    Stefano Lissa.

Reply

You must log in to post.

About this Topic