提取但只能获得状态?
附加新域时,我制作了逻辑,以检查该域是否正常通过获取工作。
fetch("https://" + domain).then((result)=>{
const isOk = result.status === 200
...
})
但是,我认为通过获取以检查整个HTML文档以检查是否有效,这将是低效的。 如何仅获得状态价值?
When a new domain is attached, I made a logic to check whether the domain works normally through fetch.
fetch("https://" + domain).then((result)=>{
const isOk = result.status === 200
...
})
However, I thought it would be inefficient to fetch the entire HTML doc through fetch just to check if it works.
How can I get only the status value?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您只能使用 <代码>头部 方法。服务器应与使用
GET
方法返回相同的标头,但没有正体。您可以使用方法
)选项:You can request only the headers, as opposed to the whole page, using the
HEAD
method. The server should return the same headers as it would if theGET
method was used, but no body. You can request this behaviour using themethod
option: