House3272 House3272 - 6 months ago 31
HTML Question

Is it possible to hard code the contents of an iframe?

A script, for example, can either be linked:

<script src="myscript.js"></script>


or embedded:

<script type="text/javascript">
//myscript
</script>


Is there a way to do this with iframes?
Manually embed a webpage within a webpage before reaching the client's browser?

To the same effect, is it similarly possible to embed the decoded base64 of an image between img tags?

Answer

You're looking for the srcdoc attribute. It's got pretty good support, but no IE/Edge yet.

http://caniuse.com/#feat=iframe-srcdoc