If you want something to happen automatically when the page loads, then I think the idiomatic way within the usual Elm architecture would be to supply an `Effects` to the `init` that you supply to `StartApp.start` (or the conceptual equivalent, if you're not using `StartApp`).
That is, when you initialize your model, you ought to be able to also supply an initial action to execute -- in `StartApp`, that would be through the `init` that you supply to `StartApp.start`.
I think the reason your `onLoad` approach might not have worked is that it would normally be attached too late -- that is, it would normally be attached *after* the "load" event had already fired, so it wouldn't accomplish anything.
I'm actually doing some related work-in-progress here at the moment:
However, the use cases for what I'm doing there are a bit exotic (or possibly even non-existent) -- you'd have to be in a situation where there was a bunch of DOM to load that might not be finished loading when your Elm code runs -- which wouldn't normally be the case, since normally the Elm code is what generates most of the DOM. So, normally one would imagine that whatever non-Elm-generated DOM exists has already loaded by the time your Elm code runs. But, I suppose it might not be absolutely inevitable.