javascript - onload event on IE (with a JS error) not fired -
i have issue ie 9+. have complex javascript loaded async , supposed make request on "onload" event.
to define listener
my.addeventlistener("load", myfunction, false); my.addeventlistener = function(stype, callback, bcapture) { if ( "undefined" != typeof(window.attachevent) ) { return window.attachevent("on" + stype, callback); } else if ( window.addeventlistener ){ return window.addeventlistener(stype, callback, bcapture); } };
with break points, saw on ie, uses :
window.attachevent("onload", myfunction);
i think it's correct. works on of customer's website except 1 :
on website, there javscript error:
script5007: can not read property « split » of null or undefined
i think javascript error avoid "onload" event fired. how can detect "onload" event if page has js errors.
do have alternative?
try using <body onload="myfunction();">
(unless can't load late).
i bet it's supported in more universal way.
Comments
Post a Comment