Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the percentage of the page load using javascript?

I'm writing an iphone application and need to show a progress bar that shows the loading progress of a web page. I want to insert a JS function to this page and once I call it, it will give me the load progress (how much bytes have been loaded and the total size). Is this possible?

Thanks

like image 606
Alex1987 Avatar asked Dec 24 '09 15:12

Alex1987


1 Answers

No, it's not possible. You can emulate it by breaking up your page to small pieces and load it one by one with ajax requests but I don't think it is worth the trouble.

Another idea is to put little pieces of script like

<script>percentage += 10; updateProgressBar();</script>

through your page. That script will be executed the second browser loads (or parses) it so you will be able to estimate the progress.

like image 88
vava Avatar answered Oct 08 '22 19:10

vava