I’ve got a fairly simple posting interface for my notes. A small textarea, an optional file upload, some checkboxes for syndicating to Twitter and Flickr, and a submit button.
It works fine although sometimes the experience of uploading a file isn’t great, especially if I’m on a slow connection out and about. I’ve been meaning to add some kind of Ajax-y progress type thingy for the file upload, but never quite got around to it. To be honest, I thought it would be a pain.
But then, in his excellent State Of The Gap hit parade of web technologies, Remy included a simple file upload demo. Turns out that all the goodies that have been added to XMLHttpRequest
have made this kind of thing pretty easy (and I’m guessing it’ll be easier still once we have fetch
).
I’ve made a little script that adds a progress bar to any forms that are POSTing data.
Feel free to use it, adapt it, and improve it. It isn’t using any ES6iness so there are some obvious candidates for improvement there.
It’s working a treat on my little posting interface. Now I can stare at a slowly-growing progress bar when I’m out and about on a slow connection.
# Liked by Jan Skovgaard on Sunday, May 29th, 2016 at 8:53pm
# Liked by Oliver Joseph Ash on Sunday, May 29th, 2016 at 9:55pm
# Liked by MrMartineau on Sunday, May 29th, 2016 at 10:26pm