IMG tag onerror event resolves infinite loop error reporting

Problem Description:

problem: the SRC picture in img tag failed to load, and a fragment icon will appear in the original picture position, which is very unpleasant. How to be more beautiful

Cause analysis:

because the reverse display resource cannot be found or the path does not exist, it will be processed according to the IMG default processing method


1. Find a default picture to replace

2. Trigger with onerror event

3. The oneror event is triggered repeatedly

<img src="url" onerror= "this.οnerrοr='';this.src='static/images/nop.svg'">

Can be solved

Read More: