Why does chrome still log 404 (Not Found) errors for missing images even after an onError handler has caught the exception?

北慕城南 提交于 2019-12-13 04:56:10

问题


With reference to this issue: jQuery/JavaScript to replace broken images

I still get exceptions like this in chrome console, even when when the images are being correctly repalced using the suggestions from the linked solution above:

GET http://10.10.0.3/OC/media/profile-pics/2348022002298.jpg 404 (Not Found)

I'm an building up a large address book where images are saved by mobile number. there would potentially be 1000's of 404 errors.

Would that be a performance issues - 1000's of failed image download attempts?

IS there a more efficient solution to that suggested in the link?

My best alternative so far seems to build this up server-side and do a file replace ahead of time for files i cant find.

Suggestions please, thanks.


回答1:


Because the http requests still fail.

After they fail you use the replacement, but it's not like preventing an exception to throw up.

To further explain, using @RGraham's comment below:

the console shows errors of many types. Among which

  • Javascript exception, unless handled.
  • Network requests which return with error status(4xx,5xx).

The latter is your case. After this happens, you have a solution, but they do go and fail.



来源:https://stackoverflow.com/questions/30637260/why-does-chrome-still-log-404-not-found-errors-for-missing-images-even-after-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!