eligrey / FileSaver.js

An HTML5 saveAs() FileSaver implementation
https://eligrey.com/blog/saving-generated-files-on-the-client-side/
Other
21.58k stars 4.38k forks source link

Audit usage of navigator.userAgent, navigator.appVersion, and navigator.platform #734

Open gian1200 opened 2 years ago

gian1200 commented 2 years ago

Description

On Chrome there is an audit message when using FileSaver.js 2.0.5.

Version

2.0.5 (installed via NPM)

Evidence

image

A page or script is accessing at least one of navigator.userAgent, navigator.appVersion, and navigator.platform. Starting in Chrome 101, the amount of information available in the User Agent string will be reduced. To fix this issue, replace the usage of navigator.userAgent, navigator.appVersion, and navigator.platform with feature detection, progressive enhancement, or migrate to navigator.userAgentData. Note that for performance reasons, only the first access to one of the properties is shown. Learn more: User-Agent String Reduction

Request

Is there any plan to address this?

CtrlAltDel-me commented 2 years ago

This is the same question I asked [issue #739]. Anyway, I was just looking through the latest source code on this; eligrey is still updating the source (as of June), and I think the reference to useAgent is now only for detecting Safari (that's what the comments in the source say). I'm not sure how backward compatible the latest version is, but the eligrey seems to have addressed the userAgent warning