question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

iOS Safari 10 minor version queries not recognised (apart from 10.2)

See original GitHub issue

Background

(Originally reported on the browserslist repo here: https://github.com/browserslist/browserslist/issues/732)

We display a page to users who have an outdated browser according to our browserslist configuration. For this we use browserslist-useragent to match the user agent string against our list of supported browsers, then redirect to an “Outdated browser” page.

Description of the issue

Queries targeting minor versions of iOS Safari 10 are not recognised apart from 10.2. The non-recognised versions are treated as v10.0.0.

If I visit our web page using Safari 10.1.x, 10.2.x or 10.3.x when using the non-recognised queries I will be redirected to the “Outdated browser” page.

The following queries are not recognised:

ios_saf >= 10.1
ios_saf >= 10.3

Strangely, this query is recognised:

ios_saf >= 10.2

If I change the query to ios_saf >= 10 it work as expected, however I am unable to target minor versions as described above.

How to reproduce

https://runkit.com/camslice/ios-safari-10-minor-version-queries-not-recognised

const { matchesUA } = require('browserslist-useragent');

// user agent strings
const UA_ios_saf_10_1 = 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_1 like Mac OS X) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0 Mobile/14B72 Safari/602.1';
const UA_ios_saf_10_3_1 = 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E8301 Safari/602.1';
const UA_ios_saf_10_3_4 = 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_4 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.0 Mobile/14G61 Safari/602.1';

// only returns `true` for `ios_saf >= 10.2`
console.log(
  '10_1 >= 10.1: ' + matchesUA(UA_ios_saf_10_1, { browsers: ['ios_saf >= 10.1'] }),
  '10_3_1 >= 10.1: ' + matchesUA(UA_ios_saf_10_3_1, { browsers: ['ios_saf >= 10.1'] }),
  '10_3_1 >= 10.2: ' + matchesUA(UA_ios_saf_10_3_1, { browsers: ['ios_saf >= 10.2'] }),
  '10_3_1 >= 10.3: ' + matchesUA(UA_ios_saf_10_3_1, { browsers: ['ios_saf >= 10.3'] }),
  '10_3_4 >= 10.1: ' + matchesUA(UA_ios_saf_10_3_4, { browsers: ['ios_saf >= 10.1'] }),
  '10_3_4 >= 10.2: ' + matchesUA(UA_ios_saf_10_3_4, { browsers: ['ios_saf >= 10.2'] }),
  '10_3_4 >= 10.3: ' + matchesUA(UA_ios_saf_10_3_4, { browsers: ['ios_saf >= 10.3'] }),
  ''
);

// returns `true` as expected
console.log(
  '10_1 >= 10: ' + matchesUA(UA_ios_saf_10_1, { browsers: ['ios_saf >= 10'] }),
  '10_3_1 >= 10: ' + matchesUA(UA_ios_saf_10_3_1, { browsers: ['ios_saf >= 10'] }),
  '10_3_4 >= 10: ' + matchesUA(UA_ios_saf_10_3_4, { browsers: ['ios_saf >= 10'] }),
);

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
aicommented, Sep 29, 2022

Seems like the problem is inside matchesUA() so I will leave it for @pastelsky

0reactions
camslicecommented, Oct 31, 2022

@pastelsky almost! All the test queries work apart from ios_saf >= 10.1

I’ve updated the runkit to demonstrate: https://runkit.com/camslice/ios-safari-10-minor-version-queries-not-recognised

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · browserslist/browserslist-useragent - GitHub
A utility to match a browserslist query with user agent strings - Issues ... iOS Safari 10 minor version queries not recognised (apart...
Read more >
If Safari isn't loading websites or quits on your iPhone, iPad, or ...
If you can't load a website or webpage, or Safari quits unexpectedly, follow these steps.
Read more >
HTML Standard
An understanding of Web IDL, HTTP, XML, Unicode, character encodings, JavaScript, and CSS will also be helpful in places but is not essential....
Read more >
Safari version history - Wikipedia
The version history of Safari spans from 2003 to the present (2022), from its initial preview release for macOS to Safari 16, first...
Read more >
Release Notes | Firebase - Google
SDK Releases. The Firebase Android SDKs for Cloud Functions, Cloud Firestore, and Performance Monitoring have been updated. The App Distribution ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found