Passing HTML Code to an iframe?

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
Randwulf
Forum Commoner
Posts: 63
Joined: Wed Jan 07, 2009 7:07 am

Passing HTML Code to an iframe?

Post by Randwulf »

I have the following chunk of code:

Code: Select all

 
preload = new Element('iframe', {
    'src': URL,
    'id': mediaId,
    'width': mediaWidth,
    'height': mediaHeight,
    'allowtransparency': 'true',
    'frameborder': 0
    });
I have a script that generates some HTML code which is saved as string variable "content" and I'd like to display that code in this iframe. Is that possible? Or can an iframe only be used to access a URL?

Thanks
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Re: Passing HTML Code to an iframe?

Post by kaszu »

nazg
Forum Newbie
Posts: 12
Joined: Thu Dec 03, 2009 11:52 am

Re: Passing HTML Code to an iframe?

Post by nazg »

I dont know what exactly you are trying to do so the following suggestion may not be of use. Try php. You can pass strings of html around no problem and have the iframe load the php. Or templates. I have used mako for python templating which allows me to embed python scripts and code into webpages
Post Reply