page, a placeholder for loading failure will be displayed under Chrome
and IE
(as shown in the picture), so that users can directly see that there are images being loaded. Failed, but why doesn't Firefox display a similar placeholder?
漂亮男人2017-05-19 10:35:43
Firefox is special, you can try the following activation method
Enter about:config in the address bar to find browser.display.showimageplaceholders, and set the value to true
In addition, if the picture is not displayed, it is best not to use placeholders. You can try several methods to give the default picture when the picture fails to load.
Lazy loading method, determine whether the real img is loaded successfully before src assignment
`<img src='real.jpg' alt='test' onerror="this.src='default.jpg'">
`
$('img').error(function(){
$(this).attr('src', "default.jpg");
});
ringa_lee2017-05-19 10:35:43
Firefox directly displays the content in alt, and does not have a default picture like IE/Chrome