Comments (4)
Thanks @Zizzamia @philipwalton ❤️
I recommend not checking :)
Okay – that's good to know 😄. I guess I was worried about some browsers reporting wrong/incomplete data, which would skew our numbers.
However, some of the APIs required to capture these metrics are only available in Chromium-based browsers (e.g. Chrome, Edge, Opera, Samsung Internet).
So just to be clear –– a browser that doesn't support a given metric (like Safari + FID) will just not report anything, right?
from web-vitals.
Okay – that's good to know 😄. I guess I was worried about some browsers reporting wrong/incomplete data, which would skew our numbers.
I mean, if a browser is reporting bad data, there's only so much the library can do to prevent that. For obviously incorrect data, the library can simply not report those cases, but for incorrect—but not obviously incorrect :)—data, we'd likely just have to report it.
Note: the FID polyfill works around some obvious errors in older browsers, which means those won't be reported by the web-vitals
library either.
So just to be clear –– a browser that doesn't support a given metric (like Safari + FID) will just not report anything, right?
Yep, exactly.
from web-vitals.
Great feedback @talsafran!
Have a clear list of where the Browser does or does not support a feature is not quite simple for these APIs. In the past, we had cases like Firefox v58 that had an old issue related to using PerformanceObserver
with entryTypes
'paint': https://bugzilla.mozilla.org/show_bug.cgi?id=1403027 . Which the only way to prevent that was with a try/catch
, me and @philipwalton had some thoughts around this on #7
With each browser implementing fully or partially those new APIs, it is quite hard to draw a clear line where the browser does or does not support the feature. What I notice the best way is "Approach 2: Check if some API exists" mix with some old school try/catch
for edge cases where the browser failed the early implementation.
Those were my quick 2cents, I am sure @philipwalton will share a better 360 overview on your question 😁
from web-vitals.
How do you currently recommend checking if this library is supported by the user agent?
I recommend not checking :)
Anyway wondering what your thoughts were. I think that ultimately it would be best if the library just abstracted away the browser support question 😄
Yep, that's exactly what it does today. If the browser does not support the API, your callback will not be fired (in that browser).
I've tried to make that clear in the documentation, but maybe what I've written is not sufficient? Any suggestions for how to make it more clear?
This code has been tested and will run without error in all major browsers as well as Internet Explorer back to version 9 (when transpiled to ES5). However, some of the APIs required to capture these metrics are only available in Chromium-based browsers (e.g. Chrome, Edge, Opera, Samsung Internet).
from web-vitals.
Related Issues (20)
- Webpack Module is undefined HOT 2
- iOS Chrome Support HOT 1
- differences in TTFB in safari vs chromium based browsers HOT 1
- LCP value setting to 0 intermittently HOT 7
- Add INP breakdown entries to the attribution build HOT 3
- User consent policy HOT 1
- Firefox LCP tests failing
- Bug: LCP attribution can include `resourceLoadDelay` attribution timings far greater than the LCP value in cases where `onTTFB` discards the navigation data HOT 1
- FCP and TTFB are triggered multiple times HOT 7
- contributing LoAF basesd code that idenifies LoAF, INF and JS long tasks data HOT 1
- Capturing metadata with events HOT 2
- Allow to reset the INP calculation HOT 2
- v4 giving undefined TypeError HOT 1
- INP: Probably a bad measurement metric for web vitals - even with simple HTML structure pages with no CSS will cause bad value. HOT 1
- Expose INP target element as first class citizen in attribution HOT 3
- Expose ability to reset internal state of metrics (specifically INP) HOT 2
- v4 INP attribution ending processingEnd time in the wrong animation frame HOT 8
- CDN JS - Web server is returning an unknown error HOT 4
- CLS and INP are being calculated incorrectly HOT 2
- Suggestion to track all attributions HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web-vitals.