Im trying to manipulate my iframe from the renderer but i can't get to the Document of the Iframe.
Component:
<aura:component access="global" implements="flexipage:availableForRecordHome,force:hasRecordId">
<iframe aura:id="FileFrame" src="about:blank" style="width:100%;height:500px"></iframe>
</aura:component>
Renderer:
({
afterRender: function(component, helper) {
var action = component.get("c.getMyVFpageA");
action.setCallback(this, function(response){
console.log('hiaudsilhudas');
var doc = component.find("FileFrame").getElement().contentDocument;
console.log(doc);
doc.open();
doc.write('<html><head><title></title></head><body>Hello world.</body></html>');
doc.close();
});
$A.enqueueAction(action);}
})
contentWindow.document
(not sure here as I got it from a SO answer) aftergetElement
or add a regular Id to the iframe and use:document.getElementById('iFrameId').contentDocument;
contentDocument
as Not To Be Supported for iframes.