I want to show a "Please wait while the page is loading..." message while my page is loading. The page contains a lot of small images which take some time to load. So I don't want to hide the message before these are loaded as well.
I tried to use dojo/domReady!
and dojo/ready
, but they fire before the images are loaded and thus the page still looks incomplete when I hide the message at this point.
The following code works, but doesn't seem to be the dojo way:
window.onload = hideLoadingMessage();
Registering to window.onload
with on
doesn't work at all:
require([ 'dojo/_base/window', 'dojo/on' ], function(win, on) {
on(win, 'onload', hideLoadingMessage);
});
How should I wait for the page to be completely loaded including all the images?