WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 5 months ago

#13347 closed enhancement (worksforme)

Mobile user agent detection for vars.php

Reported by: mrroundhill Owned by: westi
Milestone: Priority: normal
Severity: normal Version:
Component: Plugins Keywords:
Focuses: 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 4 years ago.
vars with mobile user agent detection
13347.patch (1.3 KB) - added by ocean90 4 years ago.
Patch from attached vars.php

Download all attachments as: .zip

Change History (8)

mrroundhill4 years ago

vars with mobile user agent detection

ocean904 years ago

Patch from attached vars.php

comment:1 ocean904 years ago

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

comment:2 johnbillion4 years ago

  • 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

comment:3 nacin4 years ago

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.

comment:4 follow-up: nacin3 years ago

  • 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.

comment:5 joshuaodmark3 years ago

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/

comment:6 in reply to: ↑ 4 ocean905 months ago

  • Milestone Future Release deleted
  • Priority changed from lowest to normal
  • Resolution set to worksforme
  • Severity changed from minor to normal
  • Status changed from new to closed

Replying to nacin:

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.

See [20417]/#20014.

Related: #24541, #21667, #24252

Note: See TracTickets for help on using tickets.