Make WordPress Core

Opened 12 years ago

Closed 7 years ago

Last modified 3 years ago

#21667 closed enhancement (wontfix)

Add some user agent to wp_is_mobile

Reported by: inpixelitrust's profile inpixelitrust Owned by: stevenkword's profile stevenkword
Milestone: Priority: normal
Severity: normal Version: 3.4.1
Component: General Keywords: dev-feedback has-patch needs-unit-tests
Focuses: Cc:

Description

Hello,

I've run some test with the help of the twitter/G+ community on wp_is_mobile and found some mobile browser that don't pass the test.

You can see the test here : http://www.inpixelitrust.fr/blog/wp_is_mobile/

I was able to get the user agent of 3 of those which don't work :

HTC sensation z710 4.0.3 native browser (UA: Mozilla/5.0 (X11;Linux x86_64; HTC/Sensation/3.32.162.11; fr-de)
AplliWebkit/534.24(KHTML,like Gecko) Chrome/11.0.696.32 Safari/534.34 )

BlackBerry Playbook (Ua Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.0.1; en-US) AplleWebkit/535.8+ (KHTML, like Gecko) Version/7.2.0.1 Safari/535.8+ )

Could be great to add those to the UA sniffing :)

Attachments (1)

21667.diff (2.9 KB) - added by Mte90 9 years ago.
regex based on detectmobilebrowsers.com

Download all attachments as: .zip

Change History (13)

#1 @inpixelitrust
12 years ago

  • Summary changed from Addd some user agent to wp_is_mobile to Add some user agent to wp_is_mobile

#2 @SergeyBiryukov
12 years ago

  • Component changed from Template to Administration
  • Type changed from feature request to enhancement

#4 @ocean90
11 years ago

  • Component changed from Administration to General

@Mte90
9 years ago

regex based on detectmobilebrowsers.com

#6 @Mte90
9 years ago

  • Keywords has-patch added

Now use the detectmobilebrowsers.com regex that is more powerful but is not updated from 2014 but surely is better that the actual solution.

This ticket was mentioned in Slack in #core by chriscct7. View the logs.


9 years ago

#8 @stevenkword
9 years ago

  • Keywords needs-unit-tests added
  • Owner set to stevenkword
  • Status changed from new to assigned

#9 @swissspidy
9 years ago

The patch looks reasonable, but a bit more complex.

In general I wouldn't recommend doing UA sniffing. Should we really further encourage a bad practice? Core uses wp_is_mobile() only in a few places, mostly for historical reasons where touch devices were not considered before.

#10 @Mte90
9 years ago

There are many themes that use this function and also plugin.
I know that the patch contain a complex regex but recognize the majority of mobile os.
Maybe we can choose to use a different regex more light.

#11 @johnbillion
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from assigned to closed

I'm going to wontfix this based on #33704 (removing reliance on wp_is_mobile()) and [40907] (introduce a filter on the return value of the function).

This ticket was mentioned in Slack in #core by mte90. View the logs.


3 years ago

Note: See TracTickets for help on using tickets.