Tuesday, September 23, 2014

A Better Geolocation Prompt

Derek Featherstone makes a good point: The current implementation of the geolocation prompt on most browsers does not give enough information. Wouldn't it be nice if we could provide more information to the user as to why we need this information from them? I would love to see something in JavaScript like this:
if (navigator.geolocation) {
    var geolocationApproved = 
      navigator.geolocation.prompt("This information will be used to provide you with directions to xyz.");
}
would produce something like this:

Friday, September 19, 2014

Show "loading" icon for long running AJAX calls only.

If an AJAX call is slow, then I want to present a "loading" overlay to let the user know the process is still working. However, on short calls, it is distracting to the user to flash the "loading" overlay and then immediately remove it. This code allows me to specify a time (in milliseconds) for how long to wait before showing the spinning wheel.
http://codepen.io/clarmond/pen/mvalt
 
Blogger Templates