Exactly when does an IFRAME onload event fire?

后端 未结 3 1236
逝去的感伤
逝去的感伤 2021-02-12 11:42

Does the IFRAME\'s onload event fire when the HTML has fully downloaded, or only when all dependent elements load as well? (css/js/img)

3条回答
  •  生来不讨喜
    2021-02-12 12:22

    The latter: fires only when all dependent elements (css/js/img) have been loaded as well.

    If you want to run JavaScript code when the HTML has been loaded, do this at the end of your HTML:

    
    

    Here is a relevant e-mail thread about the difference between load and ready (jQuery supports both).

提交回复
热议问题