====== Resize IFrames according to their contents ====== If you want to have IFrames integrated with the [[plugin:iframe]] plugin to have a height matching their content you can paste the following into a ''lib/plugin/iframe/script.js'': Note this only works with content served from the same server. This version is compatible with Adora Belle and earlier versions of DokuWiki. See below for Weatherwax and later. function resizeIframe(currentfr){ if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight){ //ns6 syntax currentfr.height = 50+currentfr.contentDocument.body.offsetHeight; currentfr.style.height = (50 + currentfr.contentDocument.body.offsetHeight) + 'px'; } else if (currentfr.document && currentfr.contentWindow.document.body.scrollHeight){ //ie5+ syntax currentfr.height = 50+currentfr.contentWindow.document.body.scrollHeight; currentfr.style.height = (50 + currentfr.contentWindow.document.body.scrollHeight)+'px'; } currentfr.style.display = 'block'; } addInitEvent(function(){ var frames = document.getElementsByTagName('iframe'); for(var i=0; i ===== Weatherwax ===== Here are the changes needed for Weatherwax and later versions of DokuWiki: // from https://www.dokuwiki.org/tips:resizeiframes function resizeIframe(currentfr){ if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight){ //ns6 syntax currentfr.height = 50+currentfr.contentDocument.body.offsetHeight; currentfr.style.height = (50 + currentfr.contentDocument.body.offsetHeight) + 'px'; } else if (currentfr.document && currentfr.contentWindow.document.body.scrollHeight){ //ie5+ syntax currentfr.height = 50+currentfr.contentWindow.document.body.scrollHeight; currentfr.style.height = (50 + currentfr.contentWindow.document.body.scrollHeight)+'px'; } currentfr.style.display = 'block'; } // next line replaced for compatibility with Weatherwax as per https://www.dokuwiki.org/devel:jqueryfaq?s[]=addinitevent [Rik, 2013-10-17] //addInitEvent(function(){ jQuery(function(){ var frames = document.getElementsByTagName('iframe'); for(var i=0; i