Alocola: Mobile Orchard's Safari Helper: Makes Websites "Location Aware"

On January 21, 2009

Alocola is a free web-helper application that we’ve created that lets users provide their location information when websites ask for it. It is available from the App Store now.

Alocola works with Safari. With Alocola, web developers need not create their own iPhone apps. Users simply browse in Safari the way they normally would; when a site asks for location information Alocola pops up, asks permission to give the location to the site, returns to Safari and passes the location along as part of the URL.

Motivation and Approach

It’s always bugged me that location services aren’t available in Safari.

Applications like Phone Gap deal with this limitation by wrapping websites inside a custom browser that includes location (and other) services. A PhoneGap application is installed like any other standard application. It’s a good solution for developers whose goal is to build an installable application, but not for websites that want to easily and simply add location to their sites.

Instead of wrapping an application in its own browser, Alocola works alongside Safari. Once the Alocola app is installed, it works with any site. The sites needn’t create or ask their users to install any other software. There are no platform, language, framework or other tech-choice limitations.

How It Works/Upcoming Articles

I’ll be writing a pair of follow-up tutorials demonstrating how Alocola works. For now, here’s a quick synopsis:

Alocola registers a protocol handler with the iPhone. Whenever the iPhone encounters a URL beginning with alocola:// it passes the URL to Alocola for processing.

Website authors either ask users to click on alocola:// links or redirect them to alocola:// URLs. These URLs cause Alocola to be launched. Alocola will then gather the location information and then send the user back to a URL inside the originating site. The return-trip URL is embedded/included in the alocola:// URL.

Using Alocola With A Website

The Alocola website has an easy-to-follow Web Developer Guide that demonstrates how to use Alocola with a website. The site also features a tool for easy creation of alocola:// URLs.


Because Alocola has to be opened every time a site asks for its users’ locations, Alocola is best for sites that need an occasional location coordinate, but not for those that generate breadcrumbs or tracks. For example, a site that tracks deliveries could have the couriers check in when they make a delivery, but monitoring them en-route wouldn’t be practical.

Also, a roundtrip from Safari to Alocola and back to Safari results in two open browsers windows, one for the page that launched Alocola, and a second for the page that Alocola returned the user to. I’d hoped to avoid this by including HTTP POST data when launching the return URL, giving the appearance of starting and returning to the same URL. Unfortunately, you can’t include POST data. A future version will have an optional workaround where Alocola issue an HTTP POST itself and then return the user to the same apparent URL they started from. This will introduce some complexity, including more integration work for the website.

Open Source

Alocolola’s source is available under GPL2.

0 responses to “Alocola: Mobile Orchard's Safari Helper: Makes Websites "Location Aware"”

  1. I’ve added this to my list of iPhone apps that have custom url schemes.

  2. I’ll be checking this out straight away.
    I’m loving iPhone app development!

  3. Andrew says:

    Dear Dan,

    I’ve been trying out Alocola for location based search. It’s really amazing and was easy to implement in a Rails app. I was using the horizontal accuracy option, but had to turn it off because it would keep searching eternally for a better signal when indoors (no GPS).

    Is it possible to add an optional timeout in the request URL. After the timeout (eg: 5sec) Alocola could return the determined position regardless of the accuracy.

    That would be awesome. Many thanks for this great tool!

  4. Humuhumu says:

    I’ve integrated Alocola into my web-based iPhone app, and it works beautifully. If you’d like to see Alocola in action, give it a whirl:

    Thank you so much for this — being able to add this functionality greatly improves my app.

  5. Hm, totally unnecessary since 3.0 of course, since Safari has added the navigator.geolocation interface to JavaScript.

    I know it’s an old thread but what’s up with that website?

  6. Dan Grigsby says:

    @Maarten: As you point out, 3.0 obsoletes it, so I let the domain expire.