-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Repo needs updating to pass Chrome's user agent reduction campaign #103
Comments
As far as I can see most (if not all) changes don’t affect our code
If you can see a point where it breaks we can work on a fix |
@gblazex I'll list the issues 1var isMac = /^Mac/.test(navigator.platform); becomes var isMac = /^Mac/.test(navigator.userAgentData.platform); Because 2var userAgent = window.navigator.userAgent; API to become deprecated soon! Migrate to 3var isMobile = /mobile/i.test(userAgent); becomes var isMobile = navigator.userAgentData.mobile; 4var isIEWin7 = /Windows NT 6.1/i.test(userAgent) && /rv:11/i.test(userAgent); I'm guessing that stands for "Is Internet Explorer Windows 7". Will not work anymore, because Phase 5 locks it to Windows 10 on Windows 7, 8 and 8.1 devices.
Therefore this code line is dead in the water and becomes useless. 5var isEnabledForBrowser = (isChrome || isSafari || isIEWin7) && !isMobile; becomes var isEnabledForBrowser = (isChrome || isSafari) && !isMobile; Due to Phase 5. 6var isChrome Will loop through the 7var isSafari Will loop through the 8var isEdge Will loop through the 9var isOldSafari Will loop through the |
10var isEdge = /Edge/.test(userAgent); // thank you MS You could remove this line and throw it in the bin. Because User Agent Client Hints API, will give the correct result for |
UserAgentData has 70% support
https://caniuse.com/mdn-api_navigator_useragentdata
Meanwhile the current code works virtually everywhere right now
I don’t see any indication that the above Nav.userAgent property code breaks.
Navigator.platform is deprecated and may be removed in the future
that can be swapped for a feature detected alternative.
PR is welcome
Blaze
|
Want to ask you something: I was thinking why does the repo search for Would it not be better to search for Yah can submit a pr. |
I’m not familiar with their user agents
I would assume they pretend to be chrome as much as Edge does at least
Blaze
|
Edge BrowserVersions: EdgeHTML 12.10240 - 18.19041 (are non-chromium based) Link: https://en.wikipedia.org/wiki/Microsoft_Edge#EdgeHTML Versions: Edge 79.0.309 onwards (are chromium based) Therefore Edge 79.0.309 onwards could be grouped with And |
To be honest I don’t remember which Edge is detecting the old or the new
The isEdge can be removed if it is not broken in modern edge versions
Old IE checks can be removed as well
Blaze
|
|
We shouldn’t really follow official support rather real world usage
Blaze
|
Just going to dump some data here, for anyone that wants to look it up in the future. (this data correct as of Jan 2023) Can I UseFirefox Position
Safari PositionConclsuionAll browser support except for IE (dead), Safari and iOS in near future. Apple sucks! |
Safari no signal so we don’t know how near that future is
Also even with intent from Firefox that is going to take time to land in the stable channel
Blaze
|
UserAgentData.platform reports it as “macOS”
//i flag for the regex might be the safest There
Blaze
|
It looks like Edge can be removed
Its not even Edge anymore, But Edg in useragent strings
Blaze
|
There are hundreds of chromium browsers that I know are active! But I'm just going to add the most common ones found here: At least then it adds smooth scrolling to many commonly used browsers. |
If you look at them Im 99% Sure This project already supports them as They report Chrome in user agent
Blaze
|
Fixes issue: gblazex#103
@gblazex Are you around as this repo hasn't been updated for a long time?
I'll jump dive right in to the issue, here's a screenshot of the problem:
Chrome's User-Agent Reduction Info can be found here:
https://www.chromium.org/updates/ua-reduction/
This has been going for quite a while and I'm surprised this repo hasn't been updated to pass it.
Code issues
smoothscroll-for-websites/SmoothScroll.js
Line 59 in 7d13cd2
and
smoothscroll-for-websites/SmoothScroll.js
Lines 739 to 746 in 7d13cd2
The API in the near future will be
Deprecated
and this repo should migrate tonavigator.userAgentData
e.g.
Deadline
Link: https://blog.chromium.org/2021/09/user-agent-reduction-origin-trial-and-dates.html
This started way back in Chrome 92 and currently we are in Chrome 111.
So time is running out for this repo to update.
The text was updated successfully, but these errors were encountered: