⬅︎ Back to window.onload from before
You need to check if prev_onload is null. window.onload = function() { if ( prev_onload) {prev_onload();} bar(); }
Are you sure, isn't window.onload always an object?
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
You need to check if prev_onload is null.
window.onload = function() { if ( prev_onload) {prev_onload();} bar(); }
Replies
Are you sure, isn't window.onload always an object?
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.