具有相同源 src 的多个图像 <img> 标签

Raj*_* SP 6 html browser request

如果我有数千个<img>具有相同值的图像标签src,就像这样

<img src="https://something.com/images/myimg.png" alt="" />
<img src="https://something.com/images/myimg.png" alt="" />
<img src="https://something.com/images/myimg.png" alt="" />
<img src="https://something.com/images/myimg.png" alt="" />
<img src="https://something.com/images/myimg.png" alt="" />
<img src="https://something.com/images/myimg.png" alt="" />
...
Run Code Online (Sandbox Code Playgroud)

那么,浏览器会发送 1000 个请求还是单个请求来获取图像?

Bru*_*uce 1

在研究缓存问题时,Firefox 的 Firebug 或 Chrome 中的开发人员工具等工具非常有用。如果您在任一窗口中打开“网络”面板并重新加载页面,您将看到为每个项目发送的 HTTP 状态代码。304(未修改)表示该项目是从本地缓存中检索的。此外,当它向服务器请求图像时,它通常会随图像请求一起发送一些告诉服务器的标头。