Wednesday, September 11, 2013

JavaScript API to control loading progress indicator in browser adress bar

Instead of adding a JavaScript library to indicate the loading progress of a page I propose creating a JavaScript browser API that allows the programmer to set (or get) the position of the loading bar in percent. This is useful because many sites or single-page applications asynchronously load content.

As an example it could live as an object in the window.navigator.progress namespace and have the following functions:

reset()
set the progress bar to zero

set( percent )
set the progress bar to the given percentage value

finish()
set the progress bar to the full position and possibly hide it

get()
returns the current loading progress in percent

Having said that, I noticed, that the browsers I use (firefox and chromium) don't even have the loading progress indicator anymore. I can only speculate, that this is because the vendors noticed, that the indicator wasn't helping much anymore due to the increased usage of javascript to control content in the DOM. I think that bringing back the indicator and handing control over it to the developers would be a nice touch in terms of usability.

No comments: