消除控制台中的 404 url​​ 错误? [英] Eliminate 404 url error in console?

查看:14
本文介绍了消除控制台中的 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​​ 错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆