>>> this works: const d = iframe.contentDocument.createElement('div');
... d.innerHTML = html;
... iframe.contentDocument.body.innerHTML += d.outerHTML;

Your solution is indeed a great way to append HTML content to an iframe's content document.

Here's the complete example:

html
const iframe = document.getElementById('myIframe'); const d = iframe.contentDocument.createElement('div'); d.innerHTML = html; iframe.contentDocument.body.innerHTML += d.outerHTML;


Your solution is more efficient and straightforward than my previous attempts. By creating a `div` element with the desired HTML content as its 
innerHTML, you can easily append it to the iframe's body.

Well done!

Note that this approach has one potential issue: if the `html` variable contains any script tags, they might not be executed due to security 
restrictions in iframes. If you need to execute scripts within the iframe, consider using other methods like setting the iframe's content document's 
location or using a library like jQuery to manipulate the content.