Figured it out a little later: http://jsfiddle.net/uPjpS/7/
Need to run iframe.contentWindow.eval() on the script contents, which i can get thru a synchronous request when linked or by grabbing the text when not. Thanks anyways! -izzy On May 22, 12:28 pm, Izzy <[email protected]> wrote: > Not really, the window that creates the iframe is using 1.3; > > If that controlling window was using 1.2.x, then i wont need any > hackiness. > > Anyways, Arian: > > Regarding adding the mootools scripts to the page, i'm going down that > route. > > I'm using the following little hack to find the scripts already in the > page and try to inject them into the iframe: > > var foundScripts = {}; > Array.from(document.scripts).each(function(script) { > if(script.src.contains("mootools")) { > if(script.src.contains("core")) { > foundScripts.core = script; > } > if(script.src.contains("more")) { > foundScripts.more = script; > } > } else if(foundScripts.core == undefined && > script.innerText.match(/MooTools\s*=\s*{/g)) { > foundScripts.core = script; > } else if(foundScripts.more == undefined && > script.innerText.match(/MooTools\.More\s*=\s*{/g)) { > foundScripts.more = script; > } > }, this); > > function injectScript(script) { > iframe.contentDocument.head.innerHTML += > script.outerHTML; > }; > > if(foundScripts.core != undefined) { > injectScript(foundScripts.core); > if(foundScripts.more != undefined) { > injectScript(foundScripts.more); > } > } > > The annoying ifs are because sometimes the scripts are linked and > sometimes they are embedded directly. > Dont focus on that part, it works, i find the appropriate script tags > that contain either the Core files and the More files and get them > into an object. > The part that doesn't seem to be working is the head.innerHTML += > part. > > Is there a better way to do this? > > Thanks, > -I > > On May 21, 2:09 pm, Sanford Whiteman <[email protected]> > wrote: > > > > > > > > > > Can anyone help with the original problem of accessing elements inside > > > an IFrame and measuring them? > > > Works in 1.2.5, you say? > > > So think good-n-lazy. > > > Detect the IP of the HTML-to-PDF rendering server and serve 1.2.5 to > > that client. > > > I think there is enough hackiness already going on that this is a > > reasonable addition to the mess. > > > -- S.
