What you are describing assumes that dojo itself was already loaded by the time the modal dijit.Dialog with a download message.
Now, as a rule, dojo starts after your page is fully loaded, and you usually put your dojo code inside an anonymous function passed as the dojo.addOnLoad() parameter.
This means that the rest of your page (what you call your "links") must be loaded via ajax (using, for example, dijit.layout.ContentPane ). In this way, dojo can execute before content is loaded, and your wait message may appear earlier.
It might look like this:
<html> <head> <link rel="stylesheet" href="/dojo/dijit/themes/tundra/tundra.css" type="text/css" media="screen" /> <script type="text/javascript" src="/dojo/dojo.js" djConfig="parseOnLoad:true"></script> /* make sure that you shrinksafe together your libraries and dojo for faster loading... */ <script type="text/javascript" src="/dojo/yourOwnDojoCompressedScripts.js"></script> <script type="text/javascript"> var dialog; dojo.addOnLoad(function(){ dojo.require("dijit.layout.ContentPane"); dojo.require("dijit.Dialog"); dialog = new dijit.Dialog(); dialog.setContent("<p>This page will be available in a tick!</p>"); dialog.show(); }); </script> </head> <body class="tundra"> <div id="delayedContent" dojoType="dijit.layout.ContentPane" href="/myContentUrl" onLoad="dialog.hide()"> </div> </body> </html>
The only drawback of this plan is dojo itself: expect your shrinksafed library to weigh more than 90K (maybe up to 300K, depending on how many things you put there). With a slow connection, this takes considerable time to download. However, we are talking about a static 90K --- the same user will only download it once per session, and even less often than if you take the time to set the appropriate cache / expiration headers when these static files are served.
pierdeux
source share