I have an iframe
, created like this:
<iframe id="frame"></iframe>
Now, I also have a string in my JavaScript
:
var myString = `\
<html>\
<head>\
</head>\
<body>\
<h1>Hello World!</h1>\
</body>\
</html>\
`
I want to write the iframe
code from this string. Ideally, in a perfect world, I would use something like this:
myFrame.write(myString); //Obviously this wouldn't work
How can I do this? Thanks!