我注意到一个奇怪的警告信息,当使用谷歌chrome检查器(F12)查看下载的资源:

注意显示临时标题

我发现一些可能相关的东西,网络面板:添加临时请求头的警告,但我不能完全理解它。相关问题可以发现Chrome块请求以及XMLHttpRequest无法加载。未加载的资源显示警告:显示临时标头。

与第一个问题类似,我的资源被阻塞了,但后来自动加载了相同的资源。不像第二个问题,我不想解决任何问题;我想知道这条信息是什么意思以及我为什么收到它。


当前回答

在我的情况下,我在post请求中发送的主体参数,以及我根据主体参数编写的逻辑都是错误的,因此无法发送响应。所以我得到了这个错误。

 example: post request body (a: alsldfjfj) which I was sending

但我写的代码是验证“b”而不是“a”

其他回答

我怀疑我的回答是否能及时帮助到你,但其他人可能会觉得它有帮助。我在创建jQuery Ajax Post脚本时遇到了类似的问题。

原来,我有一个错字在一个标签的href属性,我正在使用火的帖子。我输入了href=" javacscript:;"(颠倒's'和'c')..这导致脚本在文章试图触发时尝试刷新页面。纠正了拼写错误,它为我工作得很好。

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查询循环会导致响应延迟。

如果您正在开发Asp。Net Mvc应用程序,你试图返回一个JsonResult在你的控制器,确保你添加了JsonRequestBehavior。AllowGet到Json方法。这为我解决了问题。

public JsonResult GetTaskSubCategories(int id)
{
    var subcategs = FindSubCategories(id);

    return Json(subcategs, JsonRequestBehavior.AllowGet);  //<-- Notice it has two parameters
}

我相信当实际的请求没有发送时就会发生这种情况。通常在加载缓存资源时发生。

当我发送无效的HTTP授权报头时,发生了这个问题。我忘记用base64编码了。