user966041 user966041 - 1 year ago 53
HTML Question

HTML <frame> SRC-attribute - use html-code instead of URL

Is there a way to use pure html-code to display inside a frame instead of having to link to a specific URL/file?

For example:

NOT like this

<iframe src="left.html" name="left"></iframe>

but like this

<iframe src="here goes the html code" name="thank you SO"></iframe>

Answer Source

maybe you could inject HTML into the iFrame/Frame like described in this article:Injecting HTML into an IFrame by Michael Mahemoff.

Something like this:

var content = "<html><body><b>Hello World!</b></body></html>";

var iframe = document.createElement("iframe");

var frameDoc = iframe.document;
        frameDoc = iframe.contentWindow.document; // IE
    // Write into iframe;



Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download