I would like to create an accurate page loading bar on a website. One way I could do this would be to load a single script into the page and handle requesting the rest of the resources via the script, measuring the bar as:
the number of loaded resources
/ number of total resource requests
and update the bar's width each time a new resource finished loading.
This would require me to re-structure my page's code though, and I often find that people here know better ways of doing things. So to save myself the trouble this time:
This very similar question was asked 5 years ago, and I'm unsure if the answer is still accurate
Is there now a standard built-in page size (data size, in bytes) attribute that I can access via JavaScript?