javascript - Onload doesn't fire on "new Image()", when src is ".js" file -


am wrong in assuming, should work?

var = new image(); i.onload = function () {     alert('foo'); }; i.src = 'http://whatever.com/script.js'; 

this way onload event doesn't fire @ all. if replace last line with

i.src = 'http://somethingelse.com/image.png' 

then does. problem here? fire on image sources? allowed content types then? can't find info on that.

that's because you're getting error when try load javascript file image, , onerror event fires instead.

the onload event fires when image loaded.

i'm guessing can pass in url, long it's valid image can loaded !


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -