Jump to content

Progress bar dependant on page


Thierry

Recommended Posts

I'm trying to make a progress bar that fills up as the page is loading.
I can do this with a bunch of set variables, but then, in total disregard of how long the page might take to load, it will always take the same amount of time.
What I need is that the bar goes from 0% at the start to 100% when the page has completed loading, whether that takes 1 second or 30 seconds.
So that would mean that if the page will take longer to load (say a heavy search query) the progress bar will fill up more slowly accordingly (like with your browser).
Is there any PHP (or javascript) function/value that can help me with this?

Currently I can only make it last for the same amount of time using a loop and then a flush.
Link to comment
Share on other sites

Thats probably true, but I still want to be able to do this.
Basicly all I need is some kind of value which I can use to modify the amount of time for the bar to fill up.
(basicly some kind of indication of how long it might take to load the current page).
Link to comment
Share on other sites

To do a progress bar you have to know one of two things:  the total time the script will take to execute before it executes, so you can then take the time elapsed and compare it to the time needed and give a percentage...or you need a way to measure the progress of the script, so if the script has finished 20% of itself, then you let the user know that.
Link to comment
Share on other sites

Any ideas on how I can figure out how long any given script is going to take? If I for instance do a search on something that yields a lot of results, then naturally the bar should fill up slower.
Any javascript or PHP value or function that can calculate the total time of the execution?
Link to comment
Share on other sites

Anything else then PHP javascript that can be used? Something from the system itself? (like starting a word application or something). The browser loading bar does seem dependant on page loading time so there must be something.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.