Why is Chrome's onerror event for the img element only fired once?

后端 未结 5 2013
时光说笑
时光说笑 2020-12-17 21:44

Why is Chrome is only calling the onerror event for the img element one time when all other browsers (IE7,8,9, FF, Opera, and Safari) all call it repeatedly?

Is ther

5条回答
  •  旧巷少年郎
    2020-12-17 22:16

    This is the correct behavior. You don't want to download the same image twice -- that's a waste of bandwidth.

    What Chrome does it create an in-memory object and then will apply it to all images with the respective src.

    If you need it downloaded twice, then create those objects through javascript and assign .onload=function() { .. } to each.

提交回复
热议问题