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 错误?
基础教程推荐
- 在 contenteditable 中精确拖放 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
