Click here to Skip to main content
6,292,426 members and growing! (9,793 online)
Email Password   helpLost your password?
Web Development » Client side scripting » General     Intermediate

Progressbar for Slow Loading Webpages

By Vasudevan Deepak Kumar

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.
Javascript, eVC 3.0, Win Mobile, Mobile, Win2K, WinXP, Win2003, Vista, TabletPC, Embedded, Visual Studio, Dev, QA
Posted:18 Sep 2004
Views:83,679
Bookmarked:21 times
Announcements
Loading...
 
Search    
Advanced Search
printPrint   Broken Article?Report       add Share
  Discuss Discuss   Recommend Article Email
21 votes for this article.
Popularity: 1.84 Rating: 1.39 out of 5
17 votes, 81.0%
1
1 vote, 4.8%
2

3
2 votes, 9.5%
4
1 vote, 4.8%
5

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


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







Occupation: Web Developer
Location: India India

Other popular Client side scripting articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 7 of 7 (Total in Forum: 7) (Refresh)FirstPrevNext
GeneralAny help for loading half a page? PinmemberVincentkezel22:02 8 Sep '07  
QuestionThis is a "must avoid at all costs" from an accessibility perspective! [modified] Pinmembervolkan.ozcelik7:36 9 Jun '06  
AnswerRe: This is a "must avoid at all costs" from an accessibility perspective! Pinmembersteve_in_plano12:45 14 Jul '06  
General???? please help Pinmember2bchivalrous8:34 3 Aug '05  
GeneralRe: ???? please help PinsussErrol Langlois6:01 7 Sep '05  
AnswerOne Solution PinmemberRameshKrishnan.NET5:43 20 Apr '07  
GeneralDemo? PinsussAnonymous1:33 19 Sep '04  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 18 Sep 2004
Editor: Smitha Vijayan
Copyright 2004 by Vasudevan Deepak Kumar
Everything else Copyright © CodeProject, 1999-2009
Web19 | Advertise on the Code Project