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

Is FileSaver.js ready for upcoming changes with navigator.userAgent in Chrome? #739

Open CtrlAltDel-me opened 2 years ago

CtrlAltDel-me commented 2 years ago

I am getting this information message using chrome:

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.

Affected resources:

FileSaver.js:1

Is the current version of FileSaver.js ready for this change?

Bykiev commented 2 years ago

I don't think it's ready as using userAgent to detect mac web view https://github.com/eligrey/FileSaver.js/blob/9806041b0e800979dddabbaa1b5f6ce6952d7cd7/src/FileSaver.js#L72

CtrlAltDel-me commented 2 years ago

@Bykiev 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 in a way that you'll still get it (because of compatibility with Safari) but it will work with the new webpack stuff that most browsers have. I don't know if this will work with old web browsers.