code et al
jordan at jordanhollinger dot com
powered by eridu

Showing recent posts tagged with javascript

Async, ajax uploads with HTML5

July 27, 2012 | ajax, html5, javascript

HTML5 is orange! Everyone loves Gmail's async-drag-and-drop-with-progress bar attachment UI. While I'd heard that HTML5 supports this type of upload, I found myself sticking with the nasty old form submission model.

While writing a media manager for eridu, I decided to finally look into it. My research into the progress element, the drop event, and the FileReader object bore a tiny ~180 line Sinatra app. Download it, run ruby dropbox.rb, and you have a complete reference implementation of a Gmail-like uploader.

Here, I'll walk though a more basic version...

read more →

Disable the back button using HTML5

June 8, 2012 | html5, javascript

While it's impossible to absolutely, unequivocally prevent users from traversing their browser history, you can easily prevent their Back button, Backspace key, etc. from taking them back to the previous page. Should you? Probably not, but sometimes it's really really helpful.

Read on for a description and example of using history.pushState and window.onhashchange to break the back button...

read more →

Unobtrusive in-field text labels

October 16, 2009 | javascript

In HTML user-input forms, it is not uncommon to see text fields with "labels" as grayed-out text in the field itself which disappear when clicked. Unfortunately, it's harder than it should be.

My search for "best practices" on this technique left me...wanting. Here's my solution to doing it well...

read more →