Create a iframe and set the content directly:
var frame = document.createElement('iframe');
parentElement.appendChild(frame);
frame.contentDocument.write(result);According to Dom level 2 HTML specification, contentDocument is a property of HTMLIFrameElement.
Following code may also work. However I have not found the contentWindow property in W3C DOM specification.
var frame = document.createElement('iframe');
parentElement.appendChild(frame);
frame.contentWindow.document.write(result);

No comments:
Post a Comment