Capture iframe load complete event
问题 Is there a way to capture when the contents of an iframe have fully loaded from the parent page? 回答1: <iframe> elements have a load event for that. How you listen to that event is up to you, but generally the best way is to: 1) create your iframe programatically It makes sure your load listener is always called by attaching it before the iframe starts loading. <script> var iframe = document.createElement('iframe'); iframe.onload = function() { alert('myframe is loaded'); }; // before setting