iPixel Posted September 22, 2011 Share Posted September 22, 2011 So i was looking around for an HTML 5 progress bar, figured i'd get some good use out of it and couldn't hurt to learn how. So after some googling here and there, the following script is really the one i found to be mostly used. <progress id="bar" value="0" max="100"> <span id="fallback"><!-- Your fallback goes here --></span> </progress> <script language="javascript"> window.onload = function() { var bar = document.getElementById("bar"), fallback = document.getElementById("fallback"), loaded = 0; var load = function() { loaded += 10; bar.value = loaded; /* The below will be visible if the progress tag is not supported */ $(fallback).empty().append("HTML5 progress tag not supported: " + loaded + "% loaded"); if(loaded == 100) { clearInterval(dummyLoad); } }; var dummyLoad = setInterval(function() { load(); } ,1000); } </script> Here's my issue, unless i'm being javascript retarded... this "progress bar" is a fake. It doesnt actually load based on page content load it simply gets triggered onLoad and continues to do so at the setInterval untill it reaches 100 even if the page loaded in 1 second. So i guess my question is... is there an HTML 5 progress bar that truly represents the page loading or are we stuck with this fake just for the "look of it"? Thanks for the help! Quote Link to comment https://forums.phpfreaks.com/topic/247647-html5-progress-bar-fake/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.