Friday, September 17, 2010

Frame border problem in IE8

Making HTML content blend into your application using Frames worked
well inn all browsers except IE8 (and older ?) where getting rid of
the frame borders turned out to be quite tedious.

We first resolved it by creating our own IFrame widget, but then
resolved it by just extending the Frame class.
The problem is that IE8 requires the frameborder to be set prior to
attachment, and Frame does not have any methods to manipulate this.
The solution:


public class IFrame extends Frame {

public IFrame (){

super(init());
}

public IFrame (String url){
this();
setUrl(url);
}

/**
*
*/
private static Element init() {
IFrameElement ife = Document.get().createIFrameElement();
ife.setMarginHeight(0);
ife.setMarginWidth(0);
ife.setFrameBorder(0);
ife.setAttribute("width", "100%");
ife.setAttribute("height", "100%");
ife.setAttribute("framespacing","0");
return Element.as(ife);
}
}

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment