⬅︎ Back to window.onload from before
Are you sure, isn't window.onload always an object?
You need to check if prev_onload is null. window.onload = function() { if ( prev_onload) {prev_onload();} bar(); }
Yes because if you have not defined window.onload before you grab is using 'var prev_onload = window.onload;' prev_onload will be null instead of a function.
Comment
Are you sure, isn't window.onload always an object?
Parent comment
You need to check if prev_onload is null. window.onload = function() { if ( prev_onload) {prev_onload();} bar(); }
Replies
Yes because if you have not defined window.onload before you grab is using 'var prev_onload = window.onload;' prev_onload will be null instead of a function.