Search code examples
javascripthtmliframe

Getting the source code of an iframe


Is there anyway to get the source code of the page that an iframe loaded? I do not wish to CHANGE any of the code, I just want to READ it. I also need to be able to get this using javascript/html.


Solution

  • document.getElementById('iframeID').contentWindow.document.body.innerHTML
    

    Works in Firefox, Chrome, Opera, IE9 beta