如果我对当前正在下载的文件进行 XMLHttpRequest 会怎样?

What happens if I XMLHttpRequest for a currently downloading file?

我正在尝试逐步增强 PJAX 风格的链接。我正计划将其分层放置在一些常规预取 <link>s:

之上
<link rel="prefetch" href="next.html"/>

如果浏览器已经下载 next.html,PJAX 请求应该直接命中缓存,不会造成任何伤害。但是当然,由于预取链接的实际获取完全取决于浏览器,所以我不知道那会是什么时候。

我不想让用户接受双重下载,所以我考虑过只取消 <link>But browsers have started preloading/rendering on the <link rel="next"/> tag too,这让事情变得复杂。

如果 XMLHttpRequest 命中 "in-flight" 下载,我可以期待什么样的浏览器行为? 我正在尝试进行自己的研究,但它充满了竞争条件和其他脏东西。

来自MDN FAQ

What happens if I click on a link while something is being prefetched?
When the user clicks on a link, or initiates any kind of page load, link prefetching will stop and any prefetch hints will be discarded. If a prefetched document is partially downloaded, then the partial document will still be stored in the cache provided the server sent an "Accept-Ranges: bytes" response header. This header is typically generated by webservers when serving up static content. When the user visits a prefetched document for real, the remaining portion of the document will be fetched using a HTTP byte-range request.