Page loader

Is it possible to display actual page loading progress like from 0% to 100%?
3 Replies
Chooβ™šπ•‚π•šπ•Ÿπ•˜
Not accurately, but you can approximate it. For example, if you have 10 images in your page, you can treat it as if each image loaded accounts for 10% of progress, without taking into account differences in file size. More accurate progress indicators beyond this are far more complex than you might imagine, and it's not just an issue of page load. It's a problem for almost all progress indicators. It applies to things like installation of software or download of files. I won't get into why it's complex, but you can research that on your own. To get the progress indicator to update, you can use the onload event. This is available for <body>, <embed>, <iframe>, <img>, <link>, <object>, <script>, <style>, and<track>. Add the appropriate amount to the total progress percent when each of these onload events happens and update the display of the progress indicator.
Aldrin
AldrinOPβ€’16mo ago
ohk, thanks πŸ‘
ἔρως
ἔρως‒16mo ago
there's a very horrible way to do this you can download the images usigng xhr, which has progress indicators (using the "progress" event) this has the advantage of being accurate, but the disadvantage of not being easy to cache
Want results from more Discord servers?
Add your server