Link to home
Start Free TrialLog in
Avatar of minnirok
minnirok

asked on

Get contents of iframe

Hi,

I just want to get the contents of an iframe on my page. My iframe is defined like:

    <iframe id = "e_body" name = "e_body" src="about:blank"></iframe>

Now I have a function where I want to get the inner contents of the frame, whatever the user has typed in there:

function GetIFrameContentsPlease()
{
    var strContents = document.getElementById("e_body").document.body.innerHTML;

    alert("the contents are: " + strContents);
}

But getting the content always fails, how can I get it?
Avatar of bubbledragon
bubbledragon

document.frames("e_body").document.body.innerHTML;
ASKER CERTIFIED SOLUTION
Avatar of bubbledragon
bubbledragon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Because of security concerns, you cannot get the innerHTML cross domain (without appropriate priviledges).
Avatar of minnirok

ASKER

yes finally it works!