PDA

View Full Version : autoEl with a custom component



gameboy87
15 Feb 2013, 1:44 AM
Hi,

I created a iframe custom component with autoEl config as,


autoEl{
tag:'iframe',
src='',
},
load:function(config){
var d = this.getEl();
d.dom.src = 'config.url'+'?action=get_data';
d.dom.onload = function(){
//get the 404 error from server and display some Error.
}
}



My question is that, the 404 is error is caught in FF, chrome. But it is not caught in IE. I read in some stackoverflow sites that, IE doesn't allow adding on load event dynamically. If so, how to catch the 404 error in IE ?

Thanks,
g87

vasanth.kvj
15 Feb 2013, 8:54 AM
http://msdn.microsoft.com/en-in/library/ie/cc197053%28v=vs.85%29.aspx


object.onerror = handler;

gameboy87
16 Feb 2013, 2:07 AM
Inside the load event of the custom component, I created

d.dom.onerror = function(){
//alert();
}

But this doesn't come inside the loop.

I tried catching what browser is & it came inside the loop for IE with,


if(Ext.isIE9 || Ext.isIE8 || Ext.isIE7){
e.dom.onreadystatechange = function(){
if(e.dom.readyState == 'complete'){
if(e.dom.attachEvent){
e.dom.attachEvent('onload', function(){
Ext.Msg.show({
title:'File Missing',
msg:'Error message goes Here !',
buttons:Ext.Msg.OK,
icon:Ext.MessageBox.ERROR
});

});
}//attachEvent
}//readyState
};//onreadystatechange
}



This Worked ! :D