I am pretty sure that gmail uses js and ajax, but they are still most likely showing you the progress they are making when loading your data (gmail info), not the progress of the page itself. Plus, even if you get all the information from the server there is still the rendering time, which could be significant depending on the size/crudeness of the web page being rendered. As mentioned above, your browser is the only one that can provide an accurate progress bar, which it does based on (I believe) percentage of resources acquired from the server. I am pretty sure that even your browser progress bar will show completed when sometimes the page has not yet rendered.
In short, I believe what you are trying to do is valid from an understanding/coding point of view, but not achievable from a percentage progress bar point of view because at the very end it could still take significant time to render the page even after all resources have been acquired.