[Zope] Telling Users to Wait

Martijn Pieters mj@zope.com
Mon, 19 Nov 2001 16:07:59 -0500


On Mon, Nov 19, 2001 at 03:52:14PM -0500, Casey Duncan wrote:
> On Monday 19 November 2001 02:39 pm, Edmund Goppelt allegedly wrote:
> > How do I warn my users that a given Zope page will take a long time to
> > load?  Is there any way to load a preliminary "please wait this may
> > take a while" page while the user waits for the real page to load?
> 
> The only way I know of is to use Javascript (although there may be a RESPONSE 
> header you can set). Use something like this as the page with the wait 
> message:
> 
> <dtml-var standard_html_header>
> <h2><dtml-var title_or_id> <dtml-var document_title></h2>
> <p>
> This might take a while...
> </p>
> <script type="text/javascript">
>  location.href='http://server/slow_page';
> </script>
> <dtml-var standard_html_footer>
> 
> of course that assumes javascript is turned on. What you can do to make sure 
> it still works without it is to write the original link with javascript and 
> include a <noscript> tag with a link directly to slow_page.

A better way is to use the HTTP Refresh header. Remove the Javascript from
the above example, and add:

  <dtml-call "REQUEST.addHeader('Refresh',
                                '0;URL=http://server/slow_page')">

This will cause the browser to load the slow page URL right after it
received this page.

-- 
Martijn Pieters
| Software Engineer  mailto:mj@zope.com
| Zope Corporation   http://www.zope.com/
| Creators of Zope   http://www.zope.org/
---------------------------------------------