Cross domain iframe content load detection

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

    This is how I detected the loading of a Cross-Domain Iframe,

    1. Set a unique id for the iframe ( U may use any sort of identifier, it doesn't matter )

    1. Set window event listener:
    document.getElementById("MICSMsgBoardIframe").addEventListener('load',
    
    function actionToPerform(){
      //Do your onLoad actions here
    }
    

提交回复
热议问题