JSFiddle - React, Tailwind, and code Playground
HTML
<iframe id="iframe_id"/>
JavaScript
//get the iframe
var iFrame = document.getElementById('iframe_id');
//this is your reference variable for the iframe body tag
var iFrameBody;
//get the body
if (iFrame.contentDocument) { // FF
iFrameBody = iFrame.contentDocument.getElementsByTagName('body')[0];
}
else if (iFrame.contentWindow) { // IE
iFrameBody = iFrame.contentWindow.document.getElementsByTagName('body')[0];
}
else {
iFrameBody = iFrame.contentDocument.body;
}
iFrameBody.innerHTML = "i should be in the iframe";