Click here to Skip to main content
Licence 
First Posted 18 Sep 2004
Views 104,523
Bookmarked 25 times

Progressbar for Slow Loading Webpages

By | 18 Sep 2004 | Article
Here is an earnest attempt to help a web developer to make his web audience comfortable with a relatively slow loading webpage, by giving a sort of 'Loading Please Wait' attempt.

Introduction

Most of us develop web pages generating dynamic data from databases. Summary pages and reports experience a slow loading white page, particularly when the product is on a live or a staging server. The end user on seeing the white page would be tempted to click 'Refresh' button of the browser or 'Back' button, either or both of the operations may hinder with our normal script operations over the server side, unless explicitly handled by them.

This scenario can be remedied in a Windows Form or application, almost quite easily, since we have animation controls to keep the user engaged with the animation till the other operations like download of a huge report finishes off. Even in the case of WebForm, a little JavaScript can really come to our aid in making the page more responsive to the user, indicating to him that some operation is in progress. This coupled with the slow moving Internet Web Browser progress bar would instill some confidence to the user that the application is doing a long, time consuming work, and he need to wait a while for it to complete.

The Solution

The solution is quite simple. Just at the start of the page which is rendering the long reports, make it to render the following script code:

<DIV ID="slowScreenSplash" STYLE="position:absolute;z-index:5;top:40%;left:15%;" 
align="center">
   Please wait whilst your request is being processed...
</DIV>

This needs to come even before any rendered Tables since Web browsers delay rendering the Tables until its closing </TD> or a similar tag is reached.

With this code block in place, you will get the message:

Please wait whilst your request is being processed...

somewhere near the bottom of your screen (see the offset of 40% from top margin and 15% from the left margin).

Next Step:

Next, on report being fully loaded, this code has to be hidden. You can either call the following code in window.onload or at the fag end of the page, within the <script></script> blocks:

document.all["slowScreenSplash"].style.display = "none";

Plus:

Additionally, you can add certain JavaScript tricks like having a small 1x1 gif and keep it filling to show a sliding progress bar and all those things. But the bottom-line is to have a minimal progress indicator for the long operation that the webpage is doing and hence any inadvertent user interventions like Back button click, Refresh button click etc. may adversely affect the script operations.

I hope this code snippet and logic would be greatly useful for Web Developer fraternity worldwide.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Vasudevan Deepak Kumar

Web Developer

India India

Member

Vasudevan Deepak Kumar is from Chennai, India who has been in the programming career since 1994, when he was 15 years old. He has his Bachelors of Engineering (in Computer Science and Engineering) from Vellore Engineering College (now VIT University). He also has a MBA in Systems from Alagappa University, Karaikudi, India.


He started his programming career with GWBasic and then in his college was involved in developing programs in Fortran, Cobol, C++. He has been developing in Microsoft technologies like ASP, SQLServer 2000. For sometime, he has also been with PHP and MySQL based development in one of his previous organizations. Now currently his focus is on Microsoft .NET World (ASP.NET, C# and Whidbey)


In his past-time, he listens to polite Carnatic Music.

Web Presence


Homepage

http://www.lavanyadeepak.tk/

Blogs



Technical




Gossips



Spiritual







Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionAny help for loading half a page? PinmemberVincentkezel21:02 8 Sep '07  
I have a <frameset> with 2 frames. The 1st controls the 2nd by running a timer and loads a list of urls at set intervals in the 2nd. What I want to do is make my "nextUrl" function go as soon as a certain element is loaded. I cannot edit the pages loading in the 2nd frame. However, all these pages will have the same div tags throughout. Right now I have a long timer because these pages are long and full of JS and the point where I want to goto the next page is about in the middle of the page loading. So i don't really want to use body onload. I need to detect the second frames "target" element and execute the function in the 1st frame. If its easier to use an iframe for the "browsing frame"... thats just fine.
 
Thanks in advance for your time and comments.
QuestionThis is a "must avoid at all costs" from an accessibility perspective! [modified] Pinmembervolkan.ozcelik6:36 9 Jun '06  
AnswerRe: This is a "must avoid at all costs" from an accessibility perspective! Pinmembersteve_in_plano11:45 14 Jul '06  
General???? please help Pinmember2bchivalrous7:34 3 Aug '05  
GeneralRe: ???? please help PinsussErrol Langlois5:01 7 Sep '05  
AnswerOne Solution PinmemberRameshKrishnan.NET4:43 20 Apr '07  
QuestionDemo? PinsussAnonymous0:33 19 Sep '04  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120529.1 | Last Updated 18 Sep 2004
Article Copyright 2004 by Vasudevan Deepak Kumar
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid