View Full Version : iFrame use

18 Nov 2011, 3:06 PM

I have tried creating a new component that would integrated some html code into an iFrame. The iFrame is required to get rid of any CSS applied to the document. My code looks like

public class WelcomeMessageBox extends BoxComponent {

protected IFrameElement iFrame;
private String html = "";

public WelcomeMessageBox() {

protected void onRender(Element target, int index) {
Document d = Document.get();
setElement(DOM.createDiv(), target, index);

iFrame = d.createIFrameElement();
iFrame.setPropertyInt("frameBorder", 0);


public void setHtml(String html) {
if(isRendered()) {
else {
this.html = html;

The problem is that on IE I have a Null pointer access because when calling getBody within the onRender function, it returns Null. I don't know how to wait until the frame body is rendered.

Does anyone know how to perform that ?

Thanks !