Make WordPress Core

Opened 8 years ago

Closed 4 years 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:


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 8 years ago.
vars with mobile user agent detection
13347.patch (1.3 KB) - added by ocean90 8 years ago.
Patch from attached vars.php

Download all attachments as: .zip

Change History (8)

8 years ago

vars with mobile user agent detection

8 years ago

Patch from attached vars.php

#1 @ocean90
8 years ago

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

#2 @johnbillion
8 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

#3 @nacin
8 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.

#4 follow-up: @nacin
8 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.

#5 @joshuaodmark
7 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.


#6 in reply to: ↑ 4 @ocean90
4 years 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.