Skip to content Skip to sidebar Skip to footer

Use Jquery To Insert Html Into An Iframe Body Tag

I am using a hosted CMS that renders an iFrame within another iFrames. These iFrames are loaded from the same domain but since this is a hosted CMS I do not have access to these iF

Solution 1:

The problem is that you are trying to access a nested frame.

The #re_contentIframe frame is nested within #editorf, which is subsequently nested within your document.

Try:

$('#re_contentIframe').contents().find('body').find('#editorf').contents()

Fiddle: http://jsfiddle.net/8VP4y/3/

Solution 2:

haven't checked it ,might help :

var frameObject = document.getElementById('editorf');
var frameContent = frameObject.contentDocument ||
frameObject.contentWindow.document;
var insideIframe = frameContent.getElementById('re_contentIframe');
var insideIframeContent = insideIframeObject.contentDocument ||
insideIframeObject.contentWindow.document;
var $body = $('body',insideIframeContent);
$body.html('<div>contentupdated</div>');

Post a Comment for "Use Jquery To Insert Html Into An Iframe Body Tag"