Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Firefox 和 Safari 似乎存在问题,甚至不支持性能条目类型“first-paint”和“first-contentful-paint”。处理这些指标的替代方法是什么?
火狐浏览器中的错误
Safari 错误:
现在,我们使用 performance.mark 在 HTML 的开头放置一个标记,并在 body 标记的最后一行放置另一个标记。然后我们用 performance.measure 测量这两个标记之间的持续时间。也许有更好的方法来处理它。
<html> <head> <script> performance.mark('started'); <script> performance.mark('first-contentful-paint'); </script> </body>