WordPress.org

Make WordPress Core

Opened 4 months ago

Last modified 4 months ago

#53451 new enhancement

Chrome 92 userAgent notice

Reported by: superpoincare Owned by:
Milestone: Future Release Priority: normal
Severity: minor Version:
Component: General Keywords:
Focuses: javascript Cc:

Description

Starting Chrome 92, Chrome dev tools will start warning about the usage of navigator.userAgent:

https://blog.chromium.org/2021/05/update-on-user-agent-string-reduction.html

Although it is colored blue and not red and hence not an error message, it's better to not see it.

Many scripts user navigator.userAgent, especially wp-emoji.js which loads on all sites.

A way to continue using it is to see if navigator.userAgentData is true and prevent new Chrome from executing navigator.userAgent.

Attachments (1)

navigator_userAgent.code-search (7.3 KB) - added by superpoincare 4 months ago.
Files containing navigator.userAgent

Download all attachments as: .zip

Change History (4)

#1 @johnbillion
4 months ago

  • Milestone changed from Awaiting Review to Future Release
  • Version trunk deleted

Thanks for the ticket @superpoincare.

Let's start by gathering a list of all the scripts which perform logic based on the value of navigator.userAgent then we can go from there.

@superpoincare
4 months ago

Files containing navigator.userAgent

#2 follow-up: @superpoincare
4 months ago

Added a file. I found the results via VS Code's search function. Ignored minified files and external library files which have those. The search query is in the file.

24 script files in total.

Last edited 4 months ago by superpoincare (previous) (diff)

#3 in reply to: ↑ 2 @SergeyBiryukov
4 months ago

Replying to superpoincare:

Added a file. I found the results via VS Code's search function. Ignored minified files and external library files which have those. The search query is in the file.

# Query: navigator.userAgent
# Excluding: *jquery*,*mediaelement*,*moxie*,*react*,*thickbox*,*tinymce*,*min.js

Just noting that Thickbox can be patched too, it's essentially considered an "adopted" library and no longer an external library at this point.

Version 0, edited 4 months ago by SergeyBiryukov (next)
Note: See TracTickets for help on using tickets.