Submit an answer

I've left it to the user to write the if condition and return back a response. Too hard / easy?
This line overwrites anything that's already sitting in `window.onload` (probably nothing but it can be a headache to debug if it gets mixed up). Also, if this line gets executed after the load event is fired your function will never run. You're better off doing a proper load/domready check by adding an event listener and checking if it was already fired. The best approach depends on which browsers you need to support unless you don't mind adding a JavaScript library in which case the best approach is just to do that.