and the example without a line of JSNI :) but be aware of same-domain restriction when retrieving reference iframe's content.
public class IframeStyleExample implements EntryPoint { public static StyleElement addStyleSheet(FrameElement frameElement, String cssText) { Document contentDocument = frameElement.getContentDocument(); Element targetElement = contentDocument.getElementsByTagName("head") .getItem(0); if(targetElement == null){ targetElement = contentDocument.getDocumentElement() .getFirstChildElement(); if(targetElement == null){ contentDocument.insertFirst(targetElement = contentDocument .createElement("head")); } } StyleElement styleElement = contentDocument.createStyleElement(); styleElement.setType("text/css"); styleElement.setCssText(cssText); targetElement.insertFirst(styleElement); return styleElement; } @Override public void onModuleLoad() { final Frame frame = new Frame(); frame.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { FrameElement frameElement = frame.getElement().cast(); addStyleSheet(frameElement, "div {background: #ff0000;}"); } }); } } -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.