Cross domain iframe content load detection

前端 未结 6 1120
猫巷女王i
猫巷女王i 2020-12-01 11:22

I have a rather interesting problem. I have a parent page that will create a modal jquery dialog with an iframe contained within the dialog. The iframe will be populated wit

6条回答
  •  北海茫月
    2020-12-01 11:33

    The easiest way (if you can get code added to the external sites) is to have them add an invisible iframe pointing to a special html file on your domain. This could then use parent.parent.foo() to notify the original window about the load event.

    Listening for the "load" event will only tell you if the window loaded, not what was loaded or if the document is ready for interaction.

提交回复
热议问题