gpt4 book ai didi

html - 未应用 Http/2 预加载的 css 并视为未使用

转载 作者:行者123 更新时间:2023-12-03 23:15:35 25 4
gpt4 key购买 nike

我正在尝试制作一个简单的 http/2 服务器推送演示,以使用以下简单的 hello world 示例:

HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Http 2 push demo</title>
<link rel="preload" href="core.css" as="style">
</head>
<body>
Hello World!
</body>
</html>

核心文件
body {
font-size: larger;
font-weight: bold;
color: red;
}

在 Chrome 66.0.x 中,css 似乎已成功加载,但我不断收到以下警告:

The resource http://localhost:8080/core.css was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it Please make sure it has an appropriate as value and it is preloaded intentionally.



并且 css 不适用于 html 正文。

我错过了什么吗?有任何想法吗?

最佳答案

现在您只是预加载资源,但之后不会以任何方式使用它。

您仍然需要一个“正常”<link rel="styesheet" href="core.css">将此样式表实际嵌入到文档中并应用它。

关于html - 未应用 Http/2 预加载的 css 并视为未使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51613520/

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