Comments (3)
Note this was introduced for TTFB in v2.1.2.
Given the limited support for IE9 (TTFB and some form of FID), and other older browsers, I'm wondering if we should just recommended to wrap this in a module script to avoid issues with older browsers:
<!-- Append the `?module` param to load the module version of `web-vitals` -->
<script type="module">
import {onCLS, onFID, onLCP} from 'https://unpkg.com/web-vitals@3?module';
onCLS(console.log);
onFID(console.log);
onLCP(console.log);
</script>
For those that really want TTFB for these older browsers (as the only semi-reliable metric for those browsers) this could be reported with a simple performance.timing
lookup in an additional <script nomodule>
element:
<script nomodule>
if (performance && performance.timing) {
console.log(performance.timing.responseStart - performance.timing.navigationStart;);
}
</script>
Either way, we should update the docs to stop indicating that IE9 is supported when in fact it is not.
from web-vitals.
I can't reproduce this error when testing on IE9 via browserstack.com. @laoboxie can you clarify exactly what code you're running that's causing this error?
I'm trying the following, which doesn't error for me in IE9.
<script>
(function () {
var script = document.createElement('script');
script.src = 'https://unpkg.com/[email protected]/dist/web-vitals.iife.js';
script.onload = function () {
webVitals.getTTFB(console.log);
};
document.head.appendChild(script);
})();
</script>
Also, when I look at the code, I do not believe it's possible for the part of the code that calls performance.now()
to be reached in IE9 because that line is within a conditional that only runs if the browser finds a navigation
performance entry (which would not be true in IE9). See:
Lines 71 to 82 in 1d2c191
So unless I'm missing something then I think the documentation is correct in that the onTTFB()
function doesn't produce a result in IE9 but it also doesn't error:
The web-vitals code has been tested and will run without error in all major browsers as well as Internet Explorer back to version 9.
And I think it's fine to continue to make this claim because I do think we want people to be able to run this code anywhere without worry that it will error and potentially break other critical functionality on their site.
from web-vitals.
Closing this as no further updates heard back. Feel free to reopen if necessary.
from web-vitals.
Related Issues (20)
- [Question] Why is FCP not an attribution for LCP? HOT 4
- Why is onCLS firing late HOT 1
- Type 'XXXMetricWithAttribution' is not assignable to type 'MetricWithAttribution' HOT 1
- %s
- %s
- ☺️
- Webpack Module is undefined HOT 2
- Discord
- 分享自Bing: 请登录你的帐户
- GoogleChrome/web-vitals: Essential metrics for a healthy site. HOT 1
- iOS Chrome Support HOT 1
- _/release
- differences in TTFB in safari vs chromium based browsers HOT 1
- Status of Python versions
- Link
- 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
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.