[RFE] XUL iframe onload event




18 years ago
10 years ago


(Reporter: rvj, Assigned: hyatt)



Firefox Tracking Flags

(Not tracked)



(4 attachments)



18 years ago
it appears that no onload event is available for XUL iframe/browser/editor 
elements to tell if a document (htm, xml, gif, etc) has loaded or not.

Is this planned and if not could it be? 

When developing UIs some means of letting XUL scripts know when to begin  
processing is needed.  

As a work around, I have attempted to find a method of notifying XUL from the 
document itself but security seems to prevent even this option.

Apologies if this a duplicate (could nt find in XUL component)

Comment 1

18 years ago
Assignee: trudelle → hyatt


18 years ago
Severity: normal → enhancement
Ever confirmed: true
OS: other → All
Hardware: Other → All
Summary: [RFE}xul iframe onload event → [RFE] XUL iframe onload event

Comment 2

18 years ago
Marking NEW.

Comment 3

18 years ago
You do it using iframElt.addEventListener("load", myFunc, true);
Last Resolved: 18 years ago
Resolution: --- → INVALID

Comment 4

18 years ago
Sorry if I'm missing something obvious but I still cant see whats necessary to 
get the iframe load event to fire (attaching xul)

I've even altered the src assignment until after the eventlisterner is added 
(just in case it arrived beforehand) but still no joy.

Even worse the frame does not load at all- is this a separate bug? Thanks.

Comment 5

18 years ago
Created attachment 27030 [details]
xul test case for onload

Comment 6

18 years ago
uh, if it isn't loading, why would you expect its load handler to fire?

Comment 7

18 years ago
ok but that was the last test I tried which seems to show up another bug 
associated with setting the src attribute.

a) should I report it as a separate bug?

modified version of test case with src preset attached

b) can you confirm whether the iframeloaded function fires?

Comment 8

18 years ago
Created attachment 27099 [details]
simple test case for iframe onload event

Comment 9

18 years ago
There is no (to my knowledge) 'src' _property_ for the iframe binding.

The correct way to set the 'src' attribute is through the DOM 'setAttribute'
method, e.g., 

However, when I add the load listener (either bubbling or capturing), I am
not getting any event notifications (e.g., neither 'load', nor 'click' comes
Resolution: INVALID → ---

Comment 10

18 years ago
... although iframe derives from an html iframe which does have that .src
property for its DOM, but the xul iframe is not picking that up from html.

Comment 11

18 years ago
thanks - revised test case now works !

ps I guess that if src is preset the load event is not fired (maybe because it 
has already arrived?)

Comment 12

18 years ago
Created attachment 27104 [details]
working test case (without preset src)

Comment 13

18 years ago
spoke too soon !

new test case (iframe resized after load event ) results in flashing effect (is 
it continually reloading?)

I know there are a number of onload event bugs pending - is this one of them?


Comment 14

18 years ago
Created attachment 27109 [details]
flashing effect created after load event fires

Comment 15

18 years ago
and finally  (today)  ..........

I've noticed that the onload event fires fairly reliably for wan http locations 
however this does not seem to be true of lan based http locations .

FYI After clearing cache memory and disc the onload event will fire when the 
XUL application is started. However when the XUL application is subsequently  
restarted it does not.  (a caching issue?)

Comment 16

18 years ago
I already have a bug about adding the src property to iframes and browsers.
I don't understand, <iframe> has a src in the guide. 

Comment 18

18 years ago
This bug is bogus.  Events in the content DOM don't bubble across iframes.  Only
in chrome docshells does this sort of bubbling occur (and HTML iframes have a
hack that allows you to put onload right on the iframe).

If you disagree with this behavior, file an RFE on jst@netscape.com to request
that events cross iframe boundaries by default in content.
Last Resolved: 18 years ago18 years ago
Resolution: --- → WONTFIX

Comment 19

18 years ago
Thanks hyatt. Sorry for not getting back to this yesterday. Marking verified.

(To answer boberp last comment: the xul <iframe> has a 'src' _attribute_
( as in <iframe src="..." >), but does not have a 'src' _property_, (as in
document.getElementById('aFrame').src = "...";)
rvj asked me to clarify the last two comments, and I couldn't because I have no 
idea what was being said. What is docshell?

AFAIK, Mozilla doesn't support iframe onload events.

<iframe onload="alert('Blah')"  src="www.excite.com">

The alert will never fire. bug 60173. Although this isn't a dupe because he is 
talking about XUL.

Comment 21

18 years ago
Add this file as 'foop.xul' to your comm.jar package, in the 
/content/navigator/ folder. 

Then enter 
  mozilla -console -chrome chrome://content/navigator/foop.xul

<?xml version="1.0"?> 
  align="vertical" > 


var url = ['http://www.mozilla.org/xpfe/',
var idx = 0;

function iframeloaded() {
  idx = ++idx % url.length;
  window.setTimeout('foop()', 2000);

function loadxul() {
              addEventListener("load", iframeloaded, true);
    window.setTimeout('foop()', 2000);

function foop() {
    dump('foop : ' + url[idx] + '\n');
    document.getElementById("iframe").setAttribute('src', url[idx]);


<iframe id="iframe" src="http://www.mozilla.org/" flex="1"/>


Comment 22

18 years ago
And yes, it appears that jst has not done the stuff for iframe onload for 
html (bug 60173 as noted).


10 years ago
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: jrgmorrison → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.