Bug 157720 - innerWidth of iframes is wrong at the time of the onLoad event of the parent web page
Summary: innerWidth of iframes is wrong at the time of the onLoad event of the parent ...
Status: RESOLVED UNMAINTAINED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: 3.5
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-12 14:25 UTC by Ralph Moenchmeyer
Modified: 2012-06-18 18:30 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Moenchmeyer 2008-02-12 14:25:10 UTC
Version:            (using KDE 3.5.8)
Installed from:    SuSE RPMs

I use KDE 3.5.8. OS: Opensuse 10.3, Opensuse 10.2. Architecture: x86_64. Processor: AMD X2. 

For a web project I need to get the information about the innerWidth property of an iframe embedded in a page (e.g. test.html) and I need this information at the time of the onLoad event of this page. 

The relevant parts of the code are bascially

<body onLoad="init();" style="font-size:10px;" >
..
 <div style=".....">
    <iframe  id="ifr" scrolling="auto"  src="yyy.html" style="width:60.0em; ....; height:,..."></iframe>
 </div>
..
</body>
and the javascript init function contents a statement like 

function init() 
{
	var iw_ifr = window.frames[0].innerWidth;   // assuming there is only one frame in the parent page
        alert("innerWidth = " + iw_ifr); 
.....
}

The size of yyy.html is bigger than the iframe size - so scrollbars appear after the iframe content is loaded.  

The problem is the following:  
When the init() function is run (at the onLoad event of test.html) the yyy.html page inside the iframe obviously is not yet rendered. You can see a small delay between the display of the alert popup and the display of the iframe contents. Unfortunately, this coincides with a wrong number for the innerWidth property of the iframe - in my case a constant 84, which is wrong .  

After closing the alert popup one can determine innerWidth of the iframe again (e.g. by a separate function) - and then it is suddenly "correct": 600 - (width of the scrollbars) !!! 
In contrast to other browsers Konqueror subtracts the width of the scrollbars. I assume therefore that the innerWidth is determined after the contents of the iframe is rendered - then it is decided whether we need scrollbars or not. 

In any case the onLoad-event is handled too early and the init() function is run too early in comparison to the point of time when the determination of the innerWidth property takes place.  Or you can take it the other way round: The determination of the innerWidth property happens too late. 

Firefox and Opera do not have this problem. At the time when init() is run, these browsers give a innerWidth of 600 px (because they do not substract the width of the scrollbars). In my opinion this is a better handling of the situation than Konqueror's behaviour. At the time of the "onLoad" event all property information of the page's contents (including iframes) should be available.     

Additional remark: Deactivating the alert and setting the iframe attribute "scrolling" to "yes" does not help.
Comment 1 Myriam Schweingruber 2012-06-18 18:30:36 UTC
Message from the Bugsquad and Konqueror teams:
This bug is closed as outdated, as we do not have the manpower to maintain the KDE3 version anymore.
If you still can reproduce this issue with Konqueror 4.8.4 or later, please open a new report.
Thank you for your understanding.