我注意到一个奇怪的警告信息,当使用谷歌chrome检查器(F12)查看下载的资源:
注意显示临时标题
我发现一些可能相关的东西,网络面板:添加临时请求头的警告,但我不能完全理解它。相关问题可以发现Chrome块请求以及XMLHttpRequest无法加载。未加载的资源显示警告:显示临时标头。
与第一个问题类似,我的资源被阻塞了,但后来自动加载了相同的资源。不像第二个问题,我不想解决任何问题;我想知道这条信息是什么意思以及我为什么收到它。
我注意到一个奇怪的警告信息,当使用谷歌chrome检查器(F12)查看下载的资源:
注意显示临时标题
我发现一些可能相关的东西,网络面板:添加临时请求头的警告,但我不能完全理解它。相关问题可以发现Chrome块请求以及XMLHttpRequest无法加载。未加载的资源显示警告:显示临时标头。
与第一个问题类似,我的资源被阻塞了,但后来自动加载了相同的资源。不像第二个问题,我不想解决任何问题;我想知道这条信息是什么意思以及我为什么收到它。
当前回答
当我发送无效的HTTP授权报头时,发生了这个问题。我忘记用base64编码了。
其他回答
I've had this come up very recently (today in fact) where I've had an AJAX call go out to the server and Chrome fires off the "Caution: Provisional headers are shown." In the server side PHP scripting, there are MySQL queries that can be pretty much instant or take a few seconds depending on the given scenario. My server response isn't sent back to the browser until the queries are completed. I've found I get this error only when time consuming queries (up to a few seconds total) are being done and prevent the response from being sent back.
我的场景涉及到一个非常罕见的可能性,即必须通过添加/删除数百个天气模型输出列来更改一个表……因此,迭代ALTER TABLE查询循环会导致响应延迟。
My situation is cross-origin related. Situation: Browser sends OPTIONS request before sending the real request like GET or POST. Backend developer forgets to deal with the OPTIONS request, letting it go through the service code, making the processing time too long. Longer than the timeout setting I wrote in the axios initialization, which is 5000 milliseconds. Therefore, the real request couldn't be sent, and then I encountered the provisional headers are shown problem. Solution: When it comes to OPTIONS request, backend api just return result, it makes the request faster and the real request can be sent before timeout.
资源可能被一个扩展阻塞(在我的情况下是AdBlock)。
该消息之所以存在,是因为从未发出检索该资源的请求,因此显示的标头并不是真正的标头。正如在您引用的问题中所解释的那样,服务器响应时更新真实的头,但如果请求被阻塞,则没有响应。
我发现的方式是通过Chrome中的net-internals工具扩展阻止了我的资源:
chrome的最新版本
在地址栏中输入chrome://net-export/,然后按enter键。 开始录音。并保存录音文件到本地。 打开显示问题的页面。 回到net-internals 您可以查看“记录日志”文件https://netlog-viewer.appspot.com/#import 点击events(###),然后使用文本框找到与你的资源相关的事件(使用部分URL)。 最后,单击事件,看看所显示的信息是否告诉了你一些东西。
chrome的旧版本
在地址栏中输入chrome://net-internals并按enter键。 打开显示问题的页面。 返回net-internals,单击events(###),并使用文本字段查找与您的资源相关的事件(使用URL的一部分)。 最后,单击事件,看看所显示的信息是否告诉了你一些东西。
在你的代码中使用以下代码:
header('Cache-Control: no-cache, no-store, must-revalidate');
header('Pragma: no-cache');
header('Expires: 0');
这对我很有用。
在我的情况下,它只是一个错误的路径设置到资源(svg / img)