查看原文
其他

【英】Chrome中Javascript加载优先级

Addy Osmani 前端早读课 2019-06-24

前言

好久没发英文了,甚至想念。本期英文来自@Addy Osmani分享。

英文从这开始~

How browsers schedule and execute scripts can impact the performance of web pages. While techniques like <script defer><link rel=preload> (and others) influence script loading, knowing how browsers interpret them can also be helpful. Thanks to Kouhei Ueno, we now have an up to date summary of script scheduling in Chrome.

A Google Docs and HTML version of this table is also available.

Note: Loading priorities are not guaranteed to be consistent cross-browser so use this knowledge wisely and measure when unsure. Ideally, aim to delivery a great experience to the widest number of users possible.

If you’re a web developer wondering where you can see the “Loading Priority”, Chrome DevTools has an optional “Priority” column available in the Network panel. Right-click the column headers and you can switch it on:

The summary table of priorities is still correct as of February 2019. I would personally love to get a better understanding of loading priorities in other browsers too. Hopefully this overview is useful to someone out there!

Thanks to Kouhei, Dom Faralino, Pat Meenan, Kenji Baheux and Yoav Weiss for their contributions helping better explain Chrome’s network stack.

Further reading

Scheduling Scripts Intuitively and Performantly
Chrome Resource Priorities and Scheduling
Preload, Prefetch And Priorities in Chrome

关于本文
作者:@Addy Osmani
原文:https://medium.com/dev-channel/javascript-loading-priorities-in-chrome-57c54cfa6672

最后,为你推荐


【英】How To Learn CSS


【英】Removing jQuery from GitHub.com frontend


可以在公众号发送关键词 英20190228 可查看译文版

    您可能也对以下帖子感兴趣

    文章有问题?点此查看未经处理的缓存