Q: Using GWT 1.6.4, I have the following code to retrieve the dimensions of the browser window:
RootPanel panel = RootPanel.get();
int height = panel.getOffsetHeight();
int width = panel.getOffsetWidth();
Now, in the Hosted Mode browser, and in IE (but I believe the hosted mode browser uses IE, right?), this returns the correct values for both width and height. However, in FF3, width gives the correct value, but height is always zero. Can anyone explain this? Am I doing something wrong? What is the correct way to retrieve the height of the window in Firefox, and is there one method that works correctly in both IE and Firefox?
Did you try the Window.getClientHeight() and Window.getClientWidth() methods?
Check out the JavaDocs.