Version: (using KDE KDE 3.5.1) Installed from: SuSE RPMs OS: Linux Using any of the properties document.body.offsetWidth window.innerWidth document.getElementsByTagName[0].offsetWidth one always will get too small values (e.g. 76 instead of 1087) if (and only if!) the document is loaded into a frame (in the top window this problem does not occur, neither in Firefox). Here is a test case: http://www.salesianer.de/util/windowwidthframeset.html
The problem occurs only WHILE the document is being loaded into the frame or when the onload event is being evaluated. Afterwards these properties show correct values. This is a real problem for web designers who want to adjust their pages to the window with using Javascript.
Now I have improved the test case. You can see that an additional resize event is been fired, although this "resizing" is caused only by the rendering process. I still do not see any reason why in this case there is a difference between frames and top windows.
Well, the frame gets loaded and then positionned, etc. Perhaps we're resizing it twice or something
I think the simplest solution would be to delay the onload event until the last change (to size and/or position) has been made. It seems to me that other browsers (e.g. Firefox) do it that way.
Perhaps. Unfortunately nothing related to the load event is simple... Also, imagine if the frame is with display:none. It should be loaded, no? (KHTML currently messes that up for iframes, but I have a mega-patch to fix it, which is tricky due to 4.0 stabilization period..)
I've just tried the testcase with konqueror trunk. when the page is loaded the width values on both frames are the same. If I click to one of the two "Test this page in a frameset" when the page is re-loaded the first value is smaller (on that frame).
It seems fixed now (tested with KDE 4.11.4)