Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FF, Iframe and load-event after a file-download

487 views
Skip to first unread message

karfuncke...@yahoo.de

unread,
Jul 1, 2009, 10:35:33 AM7/1/09
to dev-...@lists.mozilla.org

Hi,

I have some problems, because its seems to be so, that FF is not fireing a "load" event after finischeing to load my iframe.

Here is what I've done:
- i've created a IFRAME,
- added an event-listener "load" and
- set the src attribute with javascript.
The src-Url is been loaded as it should, but the "load" event is not been fired.
The loaded file is not a HTML file, but a file-download.

Has anyone an Idea why FF not firering the event?
What is wrong on my script? Yesterday it seems to be running (after 1,5 days of work reading a lot of webpages about DOMContentLoaded & onreadystatechange. But after updating today to 3.5 it wasn't running any more. I've aready reinstalled 3.0.11, but nothing changed.
Now I don't know if it was more conincidence that it has run yesterday or something else...

IE continues working as expected, because of "onreadystatechange".

I would be very glad if anyone could give me a hint
My Code:
http://javascript.pastebin.com/m6730e0e8

Thanks,

Karfunkel



Jakob Bohm

unread,
Jul 7, 2009, 9:58:00 AM7/7/09
to
karfuncke...@yahoo.de wrote:
> Hi,
>
> I have some problems, because its seems to be so, that FF is not fireing a "load" event after finischeing to load my iframe.
>
> Here is what I've done:
> - i've created a IFRAME,
> - added an event-listener "load" and
> - set the src attribute with javascript.
> The src-Url is been loaded as it should, but the "load" event is not been fired.
> The loaded file is not a HTML file, but a file-download.
>

I am no expert, but here is my guess: When new document is loaded into
a window, tab or frame, all the handlers for that window/tab/frame are
reset to those of the new document (because it makes sense and to
prevent XSS issues). Thus when your file is loaded into the IFRAME, the
load handler for that IFRAME is set to the load handler (possibly none)
specified in that file.

Thus to make your outer document react to completion of loading content
in your IFRAME, you will have to rely on something that does not belong
to the document in that IFRAME, OR put code in the file you are going to
load.

Another option would be to load the document with XMLHTTPRequest.

karfuncke...@yahoo.de

unread,
Jul 9, 2009, 12:47:23 PM7/9/09
to dev-...@lists.mozilla.org


--- Jakob Bohm <alkwtopos...@jbohm.dk> schrieb am Di, 7.7.2009:

At first thanks for your reply. As writen above, the loaded file is not HTML-file, so your suggestion to add code in the loaded document ist not realiseble. Or at least, I don't know what kind of code I could include into a XLS or PDF file.

Your second suggestion sounds better, to use XMLHTTPRequest. I already use it for asynchronous loading of pictures, javascripts and html files. But I don't know how to download a file _and_ popup a "save-file" dialog. But maybe I'm simply thinking to complicated...

In short words, I know how to download a file using XMLHTTPRequest, but how do I pop-up the "save-file-to" dialog to save the received data to a local file?

Thanks,
Karfunkel



0 new messages