Skip to content

Conversation

@djih
Copy link
Member

@djih djih commented Oct 28, 2016

We use a fork of https://github.com/faisalman/ua-parser-js to parse browser info from the UA string. Last year (like March 2015) we added a custom regex to identify mobile chrome browsers. One of our customers noticed that we weren't getting the version number for Chrome Mobile, and turns out our custom regex needed some adjustments. Judging by the existing unit tests, the missing version number issue was actually expected (the test cases expect undefined as the parse result). I've fixed the regex and updated those old test cases.

Quick explanation of the regex: it's expecting 2 values in the match, a browser name and a browser version, but the regex is structured to only grab the version. When the library lines the matches up with the expected values, the version number doesn't get a match. To fix that I parse out chrome as well, so now there are 2 values in the match.

@djih djih merged commit f91d542 into master Oct 28, 2016
@djih djih deleted the chrome_mobile_version_parse branch October 28, 2016 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants