response.writeEarlyHints(hints)
hints<Object>
向客户端发送状态 103 Early Hints,并带有 Link 头,表示用户代理可以预加载/预连接所链接的资源。hints 是一个对象,包含要随早期提示消息发送的头部值。
【Sends a status 103 Early Hints to the client with a Link header,
indicating that the user agent can preload/preconnect the linked resources.
The hints is an object containing the values of headers to be sent with
early hints message.】
示例
const earlyHintsLink = '</styles.css>; rel=preload; as=style';
response.writeEarlyHints({
'link': earlyHintsLink,
});
const earlyHintsLinks = [
'</styles.css>; rel=preload; as=style',
'</scripts.js>; rel=preload; as=script',
];
response.writeEarlyHints({
'link': earlyHintsLinks,
});