Making WordPress.org

Opened 9 years ago

Closed 7 years ago

#1303 closed defect (bug) (fixed)

Browse Happy API detection bugs

Reported by: nacin's profile nacin Owned by:
Milestone: Priority: normal
Component: Browse Happy Keywords: needs-patch
Cc:

Description (last modified by netweb)

Migrated from: https://core.trac.wordpress.org/ticket/18281 per https://core.trac.wordpress.org/ticket/18281#comment:15

A few bugs we've noticed with the Browse Happy API so far:

  1. Mobile versions need to be labeled as such. Specifically, Mobile Safari, Opera Mini, and the Galaxy tablet, I believe. This should mean that the browser doesn't match with our list of five.
  1. For IE, we need to be looking at the Trident version numbers. Problem is, IE9 might be using a compatibility UA, which means it would get identified as IE7. Trident/5.0 is IE9, Trident/4.0 is using IE8.

I think the architecture of the API code needs some love. It served its purpose, but it's a bit inflexible for expansion. (See the Kindle hack and such.)

I'm going to open source this code onto http://code.svn.wordpress.org. It would be fantastic if some people can contribute to it and make it the best possible.

Change History (9)

#1 follow-up: @samuelsidler
9 years ago

  • Component changed from General to browsehappy.com

#2 @netweb
9 years ago

  • Description modified (diff)

Restored original ticket formatting for improved readability.

#3 @SergeyBiryukov
9 years ago

  • Reporter changed from chriscct7 to nacin

#4 in reply to: ↑ 1 @SergeyBiryukov
9 years ago

Replying to samuelsidler:

Code is here: https://meta.trac.wordpress.org/browser/sites/trunk/browsehappy.com/public_html

That's just code for the browsehappy.com site itself. Looks like the API is not open sourced yet.

#7 @SergeyBiryukov
9 years ago

@kraftbj: Thanks, missed it under core :)

#9 @coffee2code
7 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Fixed over a long series of commits outlined below (yes, in hindsight, I should have referenced this ticket in the commits as a tracking ticket). Any further suggestions should be opened in new tickets.

  • New non-mobile browser detection:
    • Add detection for Microsoft Edge [5974]
    • Add detection for UC Browser [5991]
    • Add detection for QQ Browser [5995]
    • Add detection for Pale Moon [6012]
    • Add detection for Vivaldi [6019]
    • Add support for FreeBSD, OpenBSD, and SunOS as platforms and Konqueror as a browser [6017]
    • Add detection for SeaMonkey [6018]
    • Add detection for Puffin [6020]
    • Add detection for Chromium [6021]
  • IE:
    • Set latest version as 11 and mark versions older than 11 as insecure [5949]
    • Report version number for IE 11 as '11.0' instead of '11' for consistency [5985]
    • Check for Trident token at a higher priority than MSIE when determining the version of IE [5986]
  • Opera:
    • Improve detection and recognize modern Opera user-agents [5963]
  • Safari:
    • Bump current version of Safari to 11 and mark versions earlier than 10 as insecure [5975]
  • Firefox:
    • Bump current version of Firefox to 56 and mark versions earlier than 52 (latest Extended Support Release) as insecure. [5976]
  • Chrome:
    • Fix Chrome user-agent parsing when an explicit 'Version/' value is defined, which in this case shouldn't be used. [5967]
  • Mobile browser handling:
    • Add data attribute 'mobile' to indicate if a given parsed user-agent is mobile. Generic mobile platform is set as "Mobile". [5962]
    • Replace hack to more clearly handle not making alerts for mobile browsers [5951]
    • Fix attribution of platform as Android instead of Linux [5952]
    • Improve Windows Phone OS recognition, particularly for more modern Microsoft browsers [5971]
    • Rename "Kindle" to "Kindle Browser" and remove Kindle hack [5984]
    • Improve identification of BlackBerry, Nokia, and Sony Ericsson devices generically as mobile devices if platform not otherwise known [5988]
    • Add detection for Amazon Silk as a browser and Fire OS as a platform [5984]
    • Add detection for Opera Mini [5963]
    • Add detection for Android Browser. Fixes some existing misattributed unit test cases. [5977]
    • Add detection for Nokia Browser [5979]
    • Add detection for BlackBerry Browser [5989]
    • Add detection for Samsung Browser [5994]
    • Add detection for Symbian as a platform and Ovi Browser as a browser [6011]
  • Unit testing:
    • Convert crude unit tests to PHPUnit [5948]
    • Add unit test for 'insecure' flag [5949], [5968]
    • Add unit test for the 'upgrade' parsed data field [5970]
    • Group unit test data by browser type and order them alphanumerically by browser, then platform, then version. [5965]
    • Add more unit test data [5954], [5966], [5981]
  • Browser logo images improvements:
    • Update logo images to current versions of each [13407-dotorg]
    • Use CDN to serve images. [5947]
  • Code formatting/docs:
    • Whitespace improvements [5934]
    • Add missing DocBlocks and improve existing ones [5935]
    • Add inline documentation for regexes [6038]
  • Misc
    • Use HTTPS for links to browser sites [5936]
    • Remove unused 'normalized' data attribute for recognized browsers [5978]
    • Improve handling of unknown browsers [5980]
    • Improve parsing [6010]
    • Refactor [6037]
    • Remove unnecessary starting sub-pattern for platform regex [6039]
Note: See TracTickets for help on using tickets.