本文介绍了html preload和prefetch有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Preload和prefetch都用于预先请求资源,以便以后可以快速加载资源.看来我可以互换两者

Preload and prefetch are both used to request resources in advance so that later resource loading can be quick. It seems that I can interchange the two

< link rel ="preload" href ="foo.js" as ="script">

< link rel ="prefetch" href ="foo.js">

没有任何区别.

它们有什么区别?

推荐答案

Addy Osmani写道详细介绍此内容的文章,但简短的版本是:

Addy Osmani wrote an article that goes into the details of this, but the short version is:

Prefetch向浏览器提示可能需要资源,但是代表们决定是否以及何时加载它是一个好主意浏览器.

Prefetch is a hint to the browser that a resource might be needed, but delegates deciding whether and when loading it is a good idea or not to the browser.

这篇关于html preload和prefetch有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 08:36