[英]HTTP2 Push XMLHttpRequest Cache Miss in Chrome
I'm setting the Link header to preload an XHR request that happens on load. 我将Link标头设置为预加载在加载时发生的XHR请求。
Link: </images/project_icon.png>; rel=preload; as=image,</db/xhr_stuff>; rel=preload
Chrome 57.0 preloads and uses the /images/project_icon.png
just fine but it preloads /db/xhr_stuff
and then misses the copy it just retrieved and loads it a second time after the DOM completely loads. Chrome 57.0可以很好地预加载和使用
/images/project_icon.png
,但是它可以预加载/db/xhr_stuff
,然后错过刚获取的副本,并在DOM完全加载后第二次加载。 The request headers are identical except the one later one initiated by the xhr has x-requested-with:XMLHttpRequest
set. 请求标头是相同的,除了由xhr发起的后一个标头具有
x-requested-with:XMLHttpRequest
设置。 The only other difference between the requests is the one initiated by the link header shows up as Type: json
and the second Type: xhr
in the Developer Tools. 请求之间的唯一其他区别是链接标头发起的请求在开发人员工具中显示为
Type: json
,第二个Type: xhr
。
According to the docs for XHR request, you just omit the as=
attribute. 根据XHR请求的文档,您只需省略
as=
属性。
What is missing to get a cache hit? 缺少缓存命中了什么?
If you don't provide the "as=" attribute when you push it will be ignored by the page and loaded again. 如果您在推送时未提供“ as =“属性,则页面将忽略它并再次加载。
According to the docs for XHR request, you just omit the as= attribute.
根据XHR请求的文档,您只需省略as =属性。
Where do you see this? 在哪里看到的? What "docs"?
什么是“文档”?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.