Idea: Idea: Introduce canonical is_mobile() function

  1. IKEDA Yuriko

    I suggest to introduce a canonical function to identify that the browser is a mobile device. "is_mobile" will be fine for the function name.

    There is some mobile plugins for WordPress, but handling and identification of mobile device is a little different between these plugins.

    e.g. A plugin treats PSP for mobile, another plugin does not.

    However, some plugins regards mobile mode and change the behavior: WP Super Cache, etc

    If WordPress has canonical function to identify mobile device, other plugins can easy to change behavior between PC and mobile.

    It is recommended that is_mobile() returns operator or device name, not boolean value.

    e.g. Nokia, iPhone, T-Mobile, Vodafone, DoCoMo, etc

    Second, is_mobile() can take argument and returns specific attributes.

    * is_mobile('term_name') returns detailed device name: "Nokia E61", "DoCoMo F01-A", "iPhone 3GS", etc
    * is_mobile('script') returns if the device can use java scripts.
    * is_mobile('style') returns if the device can use CSS styleseets.
    * is_mobile('3g') return if the device is a 3G phone.
    * is_mobile('cache_size') returns upper limit size of one page.
    * is_mobile('encoding') returns the desired character encoding to use.
    * is_mobile('dtd') returns specific DTD definition for the device

    Of cource, the definition of identification pattern of mobile device should be editable by plugins. Use apply_filters() or MOBILE_DEVICES constans or $wp_mobile_devices() array, etc

    Posted: 9 years ago #
  2. signpostmarv

    Quite a few problems with this idea:

    is_mobile('term_name') seems to be just a wrapper to $_SERVER['HTTP_USER_AGENT']

    is_mobile('script') won't be of much use, since you could use <noscript> to display content aimed at JS-less browsers, and use JavaScript to remove it while also altering styles to allow content requiring JS to be visible.

    is_mobile('style')- can you provide a use-case where knowing that CSS isn't supported would be useful? If a browser doesn't support CSS, it won't download linked stylesheets (if competent) & won't parse inline styles.

    is_mobile('3g')- again, use-case please? The only one I can think of is with video streaming, and you can do bandwidth tests in JS/flash to determine if a device has sufficient bandwidth to play a video.

    is_mobile('cache_size')- Keeping this up-to-date will be a near-impossible task. A very minimalist theme would be more appropriate than an extra function call, since I'm guessing you mean "one page + resources".

    is_mobile('encoding')- see $_SERVER['HTTP_ACCEPT_CHARSET']

    I'm not sure what you mean by is_mobile('dtd') "returns specified DTD definition for the device"?

    Posted: 9 years ago #
  3. Jen

    Since 2 months have gone by without response to these challenge questions, closing the thread.

    Posted: 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

  • Rating

    3 Votes
  • Status

    Sorry, not right now