gpt4 book ai didi

html - DNS 预取 Google webfonts - 哪个域?

转载 作者:太空狗 更新时间:2023-10-29 13:24:39 25 4
gpt4 key购买 nike

我在我的页面上使用了一些谷歌网络字体。使用 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还是两者兼而有之?

最佳答案

两者:

Explicit prefetches

Typically the browser only scans the HTML for foreign domains. If you have resources that are outside of your HTML (a javascript request to a remote server or a CDN that hosts content that may not be present on every page of your site, for example) then you can queue up a domain name to be prefetched.

<link rel="dns-prefetch" href="//example.com">
<link rel="dns-prefetch" href="//ajax.googleapis.com">

You can use as many of these as you need, but it's best if they are all immediately after the Meta Charset element (which should go right at the top of the head), so the browser can act on them ASAP.

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

关于html - DNS 预取 Google webfonts - 哪个域?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14820840/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com