Why does chrome still log 404 (Not Found) errors f

2019-09-16 16:12发布

问题:

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.