Opened 3 years ago

Last modified 23 months ago

#13347 new enhancement

Mobile user agent detection for vars.php

Reported by: mrroundhill Owned by: westi
Priority: lowest Milestone: Future Release
Component: Plugins Version:
Severity: minor Keywords:
Cc:

Description

We've added some user agent detection for mobile clients in the vars.php file, thought it would be good to have in core for plugins and themes to use. Attaching patched vars.php.

Attachments (2)

vars.php (3.3 KB) - added by mrroundhill 3 years ago.
vars with mobile user agent detection
13347.patch (1.3 KB) - added by ocean90 3 years ago.
Patch from attached vars.php

Download all attachments as: .zip

Change History (7)

vars with mobile user agent detection

ocean903 years ago

Patch from attached vars.php

This should be something for a (core) plugin, becauset there are much more mobile UA.

  • Component changed from Revisions to Plugins
  • Keywords vars removed
  • Owner set to westi
  • Priority changed from normal to low

There's a typo in that patch - $is_pad

I think I'm with ocean90 on this. Also, the patch changes the functionality of $is_iphone, which currently identifies all mobile Safari products, including iPad, iPhone, and the iPod touch. I see no reason to change that, or introduce additional constants when a proper detection script would be dozens more.

  • Milestone changed from Awaiting Review to Future Release
  • Priority changed from low to lowest
  • Severity changed from normal to minor

At most, we should have a single variable that tries to identify popular touch screens, and use that instead of $is_iphone where we use $is_iphone in core. (We use it for hover/display states on action links.) That's it though, I'm thinking.

I would highly suggest working in WURFL to perform mobile detection.

It comes with a single XML configuration file which allows it to be updated easily.

It has a cache mechanism that complicates things slightly, but supports the most popular cache mechanisms including a flat file system.

By doing this, it would allow WordPress to provide an object to themes & plugins that will not only detect a mobile device, but it will give advanced details in a standardized format such as screen resolution, brand, model, OS, OS version, and more.

http://wurfl.sourceforge.net/

Note: See TracTickets for help on using tickets.