How can i make something similar like GMail has http://o7.no/H72gPf
When application starting, gmail showing progress bar and it show us the percent (part) of loaded content already.
How i can mesure that certain JS file (HTML content, CSS or Images) loaded partially or fully ?
P.S. On server side I would like to use PHP
You can do this in a number of ways.
An easy way is to place your script tags (for included scripts) below the content, and have each included script call some function defined in the HEAD section of your document.
So if you define this in a script tag in the head of your document:
Then just do this at the bottom of included scripts:
What
increment_progressdoes really depends on what your progress-bar looks like, and how you build it with HTML.For example you could have a TABLE in a DIV, adding a TD to the first TABLE row each call to
increment_progress, with fixed TD widths and different background colours for TD and DIV. You then choose a width for TD’s which roughly equals (width of DIV) / (number of scripts to be loaded).Something like this:
If you’ve got a fast server and fast internet connection, you’ll barely see it 🙂
If you’re already loading scripts using AJAX, you could call
increment_progress()from your ‘response’ handler function.Update: to show how to transition to the real user interface after loading.