Cross domain iframe content load detection

前端 未结 6 1160
猫巷女王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:52

    It's possible to do this with an onload handler on the iframe itself. Unfortunately (surprise!) IE makes it difficult. The only way I could get this to work was to compose HTML for the iframe, then append it to the document with innerHTML. Then I have to poll to see when the iframe appears in the DOM, which varies depending on if the page is loading. Here's a link to the source: http://svn.openlaszlo.org/openlaszlo/trunk/lps/includes/source/iframemanager.js

    See create(), __finishCreate() and gotload(). Feel free to take a copy of this and use it yourself!

    Regards, Max Carlson OpenLaszlo.org

提交回复
热议问题