1// Webcode 2// Will set the height of an iframe to his content 3// If the attribute is not set 4window.addEventListener("load", function(event) { 5 6 // Select the iframe element with the class webCode 7 var webCodeIFrames = document.querySelectorAll("iframe.webCode"); 8 9 // Set the height of the iframe to be the height of the internal iframe 10 if (webCodeIFrames!=null) { 11 for (i = 0; i < webCodeIFrames.length; i++) { 12 var webCodeIFrame = webCodeIFrames[i]; 13 var height = webCodeIFrame.getAttribute('height'); 14 if (height == null) { 15 webCodeIFrame.height = webCodeIFrame.contentWindow.document.querySelector("html").offsetHeight 16 } 17 } 18 } 19 20 21}); 22