我注意到一个奇怪的警告信息,当使用谷歌chrome检查器(F12)查看下载的资源:
注意显示临时标题
我发现一些可能相关的东西,网络面板:添加临时请求头的警告,但我不能完全理解它。相关问题可以发现Chrome块请求以及XMLHttpRequest无法加载。未加载的资源显示警告:显示临时标头。
与第一个问题类似,我的资源被阻塞了,但后来自动加载了相同的资源。不像第二个问题,我不想解决任何问题;我想知道这条信息是什么意思以及我为什么收到它。
我注意到一个奇怪的警告信息,当使用谷歌chrome检查器(F12)查看下载的资源:
注意显示临时标题
我发现一些可能相关的东西,网络面板:添加临时请求头的警告,但我不能完全理解它。相关问题可以发现Chrome块请求以及XMLHttpRequest无法加载。未加载的资源显示警告:显示临时标头。
与第一个问题类似,我的资源被阻塞了,但后来自动加载了相同的资源。不像第二个问题,我不想解决任何问题;我想知道这条信息是什么意思以及我为什么收到它。
当前回答
当我第二次尝试为require js加载main.js时,我运行了这个问题,因为错误导致了我的更改。 我刚刚在开发工具设置中打开了“禁用缓存(当开发工具打开时)”. 这很有魅力。
其他回答
这是另一个解决方案。
如果您在使用$ajax()调用时遇到此问题,请在您的serverhost解决问题之前添加http://。
var requestURL = "http://" + serverHost;
$.ajax({
dataType: "json",
url: requestURL,
data: data,
success: success
});
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.
这可能是CORS的问题。 尝试为你的api启用CORS。
为WebApi
var cors = new EnableCorsAttribute("*", "*", "*");
config.EnableCors(cors);
在我的情况下,它只是一个错误的路径设置到资源(svg / img)
我在WordPress中使用LiteSpeed缓存插件。在那里,我启用了浏览器缓存。禁用这个功能对我有用。然后,后来我启用它以提高性能。