[JavaScript] Use onload event to execute processing after iframe loading completes
When you want to execute some processing after the content inside an iframe finishes loading, you can achieve this using the onload event.
For example, the following code executes JavaScript processing alert(‘complete’); after frame.html finishes loading inside the inline frame.
As a more specific example, I considered implementing processing to disable clicking links inside an iframe.
Using onload, the code would look like this:
HTML
window.replaceIframeHref = function(){
$("#js-iframe").contents().find("a").each(function(){
$(this).attr("href", "javascript:void(0);");
});
};
That’s all from the Gemba.