Make WordPress Core

Opened 14 years ago

Closed 9 years ago

Last modified 5 years ago

#21667 closed enhancement (wontfix)

Add some user agent to wp_is_mobile

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

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 11 years ago.
regex based on detectmobilebrowsers.com

Download all attachments as: .zip

Change History (13)

#1 @anonymized_7333845
14 years ago

  • Summary Addd some user agent to wp_is_mobileAdd some user agent to wp_is_mobile

#2 @SergeyBiryukov
13 years ago

  • Component TemplateAdministration
  • Type feature requestenhancement

#4 @ocean90
13 years ago

  • Component AdministrationGeneral

@Mte90
11 years ago

regex based on detectmobilebrowsers.com

#6 @Mte90
11 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.


11 years ago

#8 @stevenkword
11 years ago

  • Keywords needs-unit-tests added
  • Owner set to stevenkword
  • Status newassigned

#9 @swissspidy
10 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
10 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
9 years ago

  • Milestone Awaiting Review
  • Resolutionwontfix
  • Status assignedclosed

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.


5 years ago

Note: See TracTickets for help on using tickets.