473,394 Members | 1,663 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Make page wait until something happens on the server

Hi,

I have report that takes about 5-10 seconds to generate depending on the
load. I want to show the user a progress bar while it is being generated and
when it's done, forward the browser to the report.

Any suggestions?

Thank you!

Aaron
Jul 23 '05 #1
4 4887
In article <3qIOc.669$HN5.381@trndny02>, Aaron Fude says...
Hi,

I have report that takes about 5-10 seconds to generate depending on the
load. I want to show the user a progress bar while it is being generated and
when it's done, forward the browser to the report.

Any suggestions?


Don't bother. You'll need to get some information about the report
generation process to the client, which will probably involve refreshing
the entire page.

You could fudge it by just using an animated GIF, or use an animation
that doesn't indicate how far through the process the report is but does
give back some visual "feedback".

--
Hywel

http://sponsorhywel.org.uk/
Jul 23 '05 #2
"Aaron Fude" <aa*******@yahoo.com> wrote in message news:<3qIOc.669$HN5.381@trndny02>...
Hi,

I have report that takes about 5-10 seconds to generate depending on the
load. I want to show the user a progress bar while it is being generated and
when it's done, forward the browser to the report.

Any suggestions?

Thank you!

Aaron


I do not know how workable this idea is, but here it goes anyway.
The idea would be to have the report generate a graphic as it goes
along then have the client javascript download the graphic ever so
often.

You would need to use a unique file name for each instance of the
server program. You would have to figure out someway of telling the
client what the name was. You would have to be sure your were not
reading cached copy of the graphic. One way of doing this I think, is
to append ?date & time to the name of the graphic file. You would have
to figure out some way of deleting the graphics on the host.

Maybe a note that the process will take ten to fiften seconds is
enough. This isn't too long.

Robert
Jul 23 '05 #3
Aaron Fude wrote:
Hi,

I have report that takes about 5-10 seconds to generate depending on the
load. I want to show the user a progress bar while it is being generated and
when it's done, forward the browser to the report.

Any suggestions?

Thank you!

Aaron


One of the ways of handling this is to open a window when the form is submitted,
and close it once the report is completely loaded. It relies client-side
JavaScript being enabled (of course) and on the browser's ability to respond
appropriately to window.open() which many browsers will not do due to popup
blockers.

-- on the page used to initate generation of the report:

<input type="submit" value="Generate Report" onclick="openStatusWindow();">
<script type="text/javascript">
function openStatusWindow() {
if (window.open) {
var throwAway = window.open(
'status.html',
'statusWindow',
'width=400,height=200'
);
}
}
</script>

-- status.html:

<html>
<head>
<title>Generating report... please wait</title>
<script type="text/javascript">
function holdFocus() {
var t = setTimeout(holdFocus, 1000);
window.focus();
holdFocus.toString = function() {
return 'holdFocus();';
}
}
</script>
</head>
<body onload="holdFocus();">
<p align="center">Generating report... please wait</p>
</body>
</html>

-- on the page containing the resulting report:

<body onload="closeStatusWindow();">
<script type="text/javascript">
function closeStatusWindow() {
if (window.open) {
var w = window.open(
'about:blank',
'statusWindow',
'width=400,height=200'
);
if (w && !w.closed) {
w.close();
}
}
}
</script>

It's necessary to call window.open() again on the window named "statusWindow".
If you do not, you will not have a reference (handle) to it, and will not be
able to close it. I tested it in IE6SP1, Netscape 4.78, Firefox 0.9.2 and Opera
7.53 and it allowed me to open and close the window without holding a reference
to it.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #4
Aaron Fude wrote:
I have report that takes about 5-10 seconds to generate depending on the
load. I want to show the user a progress bar while it is being generated
and when it's done, forward the browser to the report.

Any suggestions?


Isn't that already done with the standard HTML form? The progress bar
will be that of the browser, if it has one (or a similar feature).

Or you use multi-document reponses like Bugzilla does.
PointedEars
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Quick Function | last post by:
Hi, I developed a site and used css. I put almost all style information in the css and used a lot of "id=my_css_class" in the html. They is little style specification in the html. I found that on...
1
by: kongsballa | last post by:
Hi! I have a webapp. that holds a lot of documents. Some of the documents needs to be produced from a database on-the-fly, some are static documents like PDF, Word documents, etc... In the end,...
4
by: Stephajn Craig | last post by:
I have one page that may take a while to process on the server, and I'd like to implement a please wait message on this page when it posts back to the server and does its business. The page is...
1
by: szabelin | last post by:
Hello, what is the page directive (was it meta something?) that causes page go call the server at predefined intervals? I used to have a link to sample code but it's broken now. thanks
2
by: Brad Quinn | last post by:
It appears that IIS hangs the first time two requests are made for same page in quick succession. Although it may very well be something else I'm doing wrong. I have a page (ViewDocument.aspx)...
9
by: tshad | last post by:
This is from my previous post, but a different issue. I have the following Javascript routine that opens a popup page, but doesn't seem to work if called from an asp.net button. It seems to work...
8
by: C.Joseph Drayton | last post by:
Hi All, I am calling a PHP script that does an operation then sends back a result. I want JavaScript to wait until that result has been recieved. I am using the following code. What can I do to...
48
by: Nathan Sokalski | last post by:
Ever since I found out that they didn't give us a way to install both IE6 and IE7 on the same machine, I have been more frustrated and annoyed with Microsoft than I ever have been with any company...
2
by: =?Utf-8?B?Z2VvZmZh?= | last post by:
I cannot figure this out and would appreciate any help..... I have a datagrid view that displays the results from a Stored Procedure. it can take awhile to load..... the stored procedure fires...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.