問題描述
我嘗試消除由于缺少源 (src) 而發(fā)生的 404 錯(cuò)誤..
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", "");
}
如果嘗試了很多方法來(lái)捕獲錯(cuò)誤,即在末尾放置一個(gè) .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
推薦答案
你不能真正從控制臺(tái)中刪除那些 404 錯(cuò)誤.您可以做的最好的事情是進(jìn)行一些 ajax 調(diào)用并查看返回碼,但隨后您將被限制為僅向您自己的域請(qǐng)求.
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.
編輯--
哦,是的,這些錯(cuò)誤將繼續(xù)顯示在請(qǐng)求"標(biāo)簽中!它們只是不會(huì)出現(xiàn)在控制臺(tái)"標(biāo)簽中(在 Chrome 中).
Oh, and yes, those errors will keep showing in the "Requests" tab! They just won't appear in the "Console" tab (in Chrome).
這篇關(guān)于消除控制臺(tái)中的 404 url?? 錯(cuò)誤?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!