DNS预取Google webfonts - 哪个域名?

Sve*_*ven 9 html css dns webfonts google-webfonts

我在我的网页上使用了一些Google网络字体.我使用谷歌提供的代码

<link href='http://fonts.googleapis.com/css?family=Pirata+One' rel='stylesheet' type='text/css'>

<head>.
看看这个CSS内部显示实际的字体是托管在http://themes.googleusercontent.com.

现在我想使用DNS预取,但我应该使用哪个域?http://fonts.googleapis.com,http://themes.googleusercontent.com或两者兼而有之?

Ane*_*new 13

都:

明确的预取

通常,浏览器仅扫描HTML以查找外部域.如果您拥有HTML之外的资源(例如,对远程服务器的javascript请求或承载可能不存在于您网站的每个页面上的内容的CDN),那么您可以排队要预取的域名.

<link rel="dns-prefetch" href="//example.com">
<link rel="dns-prefetch" href="//ajax.googleapis.com">
Run Code Online (Sandbox Code Playgroud)

您可以根据需要使用尽可能多的这些,但最好是它们都紧跟在Meta Charset元素后面(它应该位于头顶),因此浏览器可以尽快对它们起作用.

资料来源:https://github.com/h5bp/html5-boilerplate/blob/master/doc/extend.md#explicit-prefetches