I love WinTumblr - The best tumblr client for Windows
RSS

Steve'sSightings

"Not a substitute for human interaction"
Aug
22
Wed

Retrieve content of iFrame

I’ve just figured out the correct DOM to retrieve the HTML out of an iFrame. Works on IE 6+7, Firefox 2, and Safari 3.0.2. Not that any of my users use anything other than IE.

  1. var x=document.getElementById(“frm”);
  2. alert(x.contentWindow.document.documentElement.innerHTML);

I used Firebug (add-on to Firefox) to trace the DOM to find the necessary hierarchy. “outerHTML” doesn’t seem to work, but that is ok as all that is missing is the “html” tags.

Permalink