I have a string of HTML tags that I can add to or change whenever I like.
"<html><body><script language="javascript" src=""></script></body></html>"
Is it possible to load that string at runtime into an Iframe as if it was an HTML file?
This is for Construct 2. I have an object that can load HTML from a url fine, it can also insert HTML, and run scripts, but not as is.
You can do it with
See the following fiddle for an example
https://jsfiddle.net/erk1e3fg/
With Data URI, (see browser support) it's possible. The format as described is
You might not need to base64 encode your string unless the string has specific characters. This Snippet fulfills your needs:
Sure, there are a couple of different options.
Via
srcdoc
(asyncronous):Via data URI (asyncronous):
Via
document.write
(syncronous, and works in really old browsers):