Http/2 预加载 css 未应用并被视为未使用
Http/2 preloaded css is not applied and considered unused
我正在尝试获得一个简单的 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>
core.css
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">
才能将此样式表实际嵌入到文档中并得到应用。
我正在尝试获得一个简单的 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>
core.css
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">
才能将此样式表实际嵌入到文档中并得到应用。