Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 预加载多种字体格式_Html_Browser - Fatal编程技术网

Html 预加载多种字体格式

Html 预加载多种字体格式,html,browser,Html,Browser,我想用预加载字体。但是在我的@font-face中,我提供了多种格式。 为每种字体格式添加预加载链接是最佳做法吗?例如: <link rel="preload" as="font" href="...eot" type="font/eot"> <link rel="preload" as="font" href="...woff2" type="font/woff2"> <link rel="preload" as="font" href="...ttf" type

我想用
预加载字体。但是在我的
@font-face
中,我提供了多种格式。
为每种字体格式添加预加载链接是最佳做法吗?例如:

<link rel="preload" as="font" href="...eot" type="font/eot">
<link rel="preload" as="font" href="...woff2" type="font/woff2">
<link rel="preload" as="font" href="...ttf" type="font/ttf">

浏览器现在是否加载所有指定的文件,或者浏览器是否识别它们是相同的文件(格式不同)

只提供一个文件是否更好(
woff2
应该涵盖大多数浏览器)

Quotet从开始:

type
属性适用于预加载,但它不允许您排除较旧的受支持格式。这意味着您当前只能在支持woff2的浏览器中预加载woff2变体,但无法仅在不支持woff2的浏览器中预加载woff变体(因为新浏览器也支持该变体)

我的建议是只对最新的格式使用预加载,到目前为止,它可能会覆盖大多数用户。较旧的浏览器不会得到这种优化,但也可能不支持预加载,所以这很可能是好的