[Seaside] Usage of WAIframeTag

Lukas Renggli renggli at gmail.com
Wed Aug 9 06:40:41 UTC 2006

>   I want to have something like this:
>         content := #[ "ByteArray that really is a PDF" ].
>         html iframe contents: content.
>    however, that gives me a HTML page with the content as string
> representation -- not quite what I had in mind. So, how does one
>    * correctly use the canvas iframe to serve out some random
>      byte stream?
>    * set the Content-Type for that stream
>    * (would be nice) generate an URL that will be cached by the
>      browser. Is this even possible?

Sure, everything is possible.

#contents: should be used with a render block, it is basically what
you would expect when sending #with: to the tag. Though, and this is a
technical detail, the IFRAME requires that you provide the contents as
a separate file, therefor I needed to use a different selector and
setup a separate render in there. Have a look at the senders of
#iframe, especially the test in WAIframeTest.

Though #contents: is not what you want, and in fact serving documents
through an IFRAME is not implemented yes. So lets just do it by
implementing the full method and then add two convenience methods:

WAIframeTag>>document: anObject mimeType: aMimeString fileName: aFileNameString
	self src: (canvas context
		urlForDocument: anObject
		mimeType: aMimeString
		fileName: aFileNameString)

WAIframeTag>>document: anObject mimeType: aMimeString
	self document: anObject mimeType: aMimeString fileName: nil

WAIframeTag>>document: anObject
	self document: anObject mimeType: nil

This code is included in the latest Squeak version of Seaside. Add the
by yourself, if you are on VisualWorks. I also updated the test.

Hope this helps,

Lukas Renggli

More information about the Seaside mailing list