And it varies depending on the page size and even the location of the code.
Everything works fine under Firefox.
The solution is to change the value of the image src before onload is triggered, which is equivalent to having a temporary placeholder image at the beginning of the image. During the page loading process, use js to replace it with the actual required src. As long as each If src changes before the onload event is triggered, onload will behave normally.