faisalman / ua-parser-js

UAParser.js - The Essential Tool for User-Agent Detection in JavaScript & Web Development.

Home Page:https://uaparser.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Apple Message’s link preview is categorized as very old Safari version

analog-nico opened this issue · comments

Describe the bug
When I paste link into the Apple Messages app then ua-parser-js thinks that the request is made by a very old Safari version.

To Reproduce
Steps to reproduce the behavior:

  1. Open Apple Messages on Mac OS X Ventura
  2. Paste a link into a chat that is parsed by ua-parser-js on the server’s side

Or simply parse this UA:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/601.2.4 (KHTML, like Gecko) Version/9.0.1 Safari/601.2.4 facebookexternalhit/1.1 Facebot Twitterbot/1.0

Actual behavior
The above user agent is classified as a browser and says Safari version 9.0.1 although Mac OS X Ventura ships with Safari 16.4.

Expected behavior

  • This UA should possibly not be classified as a browser. But you know better how this library should work. Maybe it is correct to classify it as a browser.
  • Safari version 9.0.1 is definitely not right. I expect something in the Safari v16 range. The “Safari/601.2.4” part of the UA definitely tells us that it is one of the latest Safari v16 versions.

Desktop (please complete the following information):

  • Mac OS X Ventura
  • Messages App v14.0

Sorry, I didn’t expect that Web Kit v601 actually is equivalent to Safari v9!

I was able to look it up in the Release History section here:
https://en.wikipedia.org/wiki/Safari_version_history

So although it is debatable if this UA should really be classified as a browser – after all the UA contains all these bot names – it certainly tells the right Safari version.

I fixed the classification as a browser vs. bot by including the isbot library in my project as well. Both libraries together fit my use case.