Thierry Posted August 18, 2006 Share Posted August 18, 2006 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 https://forums.phpfreaks.com/topic/17974-progress-bar-dependant-on-page/ Share on other sites More sharing options...
ToonMariner Posted August 18, 2006 Share Posted August 18, 2006 you could fork your script or do what everyone else does and just have an animated gif without any % loading. The user is really only interested in teh fact that the browser isn't hanging so the gif still working away will satisfy them enough. Link to comment https://forums.phpfreaks.com/topic/17974-progress-bar-dependant-on-page/#findComment-76919 Share on other sites More sharing options...
Thierry Posted August 20, 2006 Author Share Posted August 20, 2006 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 https://forums.phpfreaks.com/topic/17974-progress-bar-dependant-on-page/#findComment-77618 Share on other sites More sharing options...
hitman6003 Posted August 20, 2006 Share Posted August 20, 2006 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 https://forums.phpfreaks.com/topic/17974-progress-bar-dependant-on-page/#findComment-77619 Share on other sites More sharing options...
Thierry Posted August 20, 2006 Author Share Posted August 20, 2006 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 https://forums.phpfreaks.com/topic/17974-progress-bar-dependant-on-page/#findComment-77629 Share on other sites More sharing options...
Thierry Posted August 23, 2006 Author Share Posted August 23, 2006 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 https://forums.phpfreaks.com/topic/17974-progress-bar-dependant-on-page/#findComment-79330 Share on other sites More sharing options...
hitman6003 Posted August 23, 2006 Share Posted August 23, 2006 [quote author=Thierry link=topic=104788.msg420816#msg420816 date=1156351287]The browser loading bar does seem dependant on page loading time so there must be something.[/quote]That's because it knows how much data is in/on the page...it's a part of the packet information. Link to comment https://forums.phpfreaks.com/topic/17974-progress-bar-dependant-on-page/#findComment-79516 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.