First I'll create my loading message:
<p id="loading"> Please stand by while we do something. <cfoutput>#repeatString(" ", 250)#</cfoutput> </p>
Note that I gave an ID to my loading block. This will be used later. Also note the repeatString. Why do I have that? One of the "features" of IE is that it will not render any content until it gets "enough" content. I use this block of spaces simply to slap IE around and force it to render the content. My next line of code is a simple CFFLUSH:
This is what tells ColdFusion to send the current output back to the browser. Now for the slow code. Obviously this will be custom for your application, but for my test I just used some Java:
<!--- slow process ---> <cfscript> go_to = createObject("java", "java.lang.Thread"); go_to.sleep(3000); //sleep time in milliseconds </cfscript>
You can find this code on the ColdFusion Cookbook entry.
And then I wrapped with a message to the user:
<p> Thanks for waiting. Here is your important information. </p>