That looks good to me. I did it this way: contentHeight = IFrameElement.as(yourFrame.getElement()).getContentDocument().getScrollHeight();
However, this will only work if the pages are in the same domain due to security. See http://stackoverflow.com/questions/153152/resizing-an-iframe-based-on-content On Thursday, February 9, 2012 4:15:23 AM UTC+11, Jens wrote: > > Never done it before so maybe it doesn't work, but I would try: > > yourFrame.addLoadHandler(new LoadHandler() { > public void onLoad(LoadEvent event) { > //Frame loaded. Read the content document height and resize the frame > FrameElement frameElement = yourFrame.getElement().cast(); > Document contentDoc = frameElement.getContentDocument(); > if(contentDoc != null) { > int contentHeight = > contentDoc.getDocumentElement().getOffsetHeight(); > yourFrame.setHeight(contentHeight + "px"); > } > } > }); > > > Maybe your need to wrap the implementation of onLoad() in a > Scheduler.get().scheduleDeferred(...) to make sure that the content > document and that getOffsetHeight() is available. > > -- J. > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
