Eliminate 404 url error in console?(消除控制台中的 404 url 错误?)
问题描述
我尝试消除由于缺少源 (src) 而发生的 404 错误..
I try to eleminate an 404 error occuring because the source (src) is missing..
var $chart = $("<img />")
.addClass("trend-pic")
.error(function(){
console.log("error loading..")
});
try{
$chart.attr("src", jobs[counter].url + "test/trend")
}catch(err){
$chart.attr("src", "");
}
如果尝试了很多方法来捕获错误,即在末尾放置一个 .error(function(){})
.使用 $chart.load()
- 方法检查图像是否被加载?这些都没有帮助?
if tried many stuff to catch the error i.e. putting an .error(function(){})
at the end.
use the $chart.load()
- method to check if the images gets loaded?
Non of those helped?
GET {myURLString} 404(未找到)
浏览器:Safari
推荐答案
你不能真正从控制台中删除那些 404 错误.您可以做的最好的事情是进行一些 ajax 调用并查看返回码,但随后您将被限制为仅向您自己的域请求.
You can't really delete those 404 errors from the console. The best you can do is make some ajax calls and see the return code, but then you'll be limited to request only to your own domain.
编辑--
哦,是的,这些错误将继续显示在请求"标签中!它们只是不会出现在控制台"标签中(在 Chrome 中).
Oh, and yes, those errors will keep showing in the "Requests" tab! They just won't appear in the "Console" tab (in Chrome).
这篇关于消除控制台中的 404 url 错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:消除控制台中的 404 url 错误?


- 在不使用循环的情况下查找数字数组中的一项 2022-01-01
- 从原点悬停时触发 translateY() 2022-01-01
- 我不能使用 json 使用 react 向我的 web api 发出 Post 请求 2022-01-01
- 如何显示带有换行符的文本标签? 2022-01-01
- 是否可以将标志传递给 Gulp 以使其以不同的方式 2022-01-01
- 为什么悬停在委托事件处理程序中不起作用? 2022-01-01
- 如何向 ipc 渲染器发送添加回调 2022-01-01
- 为什么我的页面无法在 Github 上加载? 2022-01-01
- 如何调试 CSS/Javascript 悬停问题 2022-01-01
- 使用 iframe URL 的 jQuery UI 对话框 2022-01-01