PDA

View Full Version : iframe load event + downloaded file



Gabor Turi
30 Jun 2010, 9:42 AM
Hi!

What is the iframe's event, when loading a downloadable file?

Ext.getBody().mask('Loading....', 'x-mask-loading');
var iframe = Ext.getBody().createChild({
tag: 'iframe',
cls: 'x-hidden'
});
iframe.on('load', function () {
Ext.getBody().unmask();
iframe.remove.defer(1000, iframe);
});
iframe.dom.src = 'download.php';The 'load' is not good, check it here: http://stack.hu/extjs/iframe_load.php


Thank you in advance! :)

Gabor

Gabor Turi
1 Jul 2010, 4:22 AM
The iframe.on('load') with 'Content-Disposition: attachment' is bad in Firefox 3.5 too: http://www.atalasoft.com/cs/blogs/jake/archive/2009/08/18/events-to-expect-when-dynamically-loading-iframes-in-javascript-take-2-thanks-firefox-3-5.aspx

This works... but this is very ugly:

Ext.getBody().mask('Loading....', 'x-mask-loading');
Ext.getBody().createChild({
tag: 'iframe',
cls: 'x-hidden',
onload: 'Ext.getBody().unmask(); var t = Ext.get(this); t.remove.defer(1000, t);',
src: 'download.php'
});
Only IE: 'readystatechange' event is work.

http://stack.hu/extjs/iframe_load.php

Animal
1 Jul 2010, 5:43 AM
If it is a different content type, as opposed to HTML, then the HTML document is not going to load, so you won't get any event.