O'Reilly logo

HTML5 Multimedia Development Cookbook by Lee Jordan, Dale Cruse

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Displaying the current location using geolocation and geo.js

In this recipe, we will use the geolocation specification and geo.js to display the current location of an active user on a map, and show their current latitude and longitude.

Getting ready

Visit http://code.google.com/p/geo-location-javascript/ to download the latest version of geo.js, or grab the link URL from the wiki (http://code.google.com/p/geo-location-javascript/wiki/JavaScriptAPI) to link to it directly online.

How to do it...

First, we will create HTML5 opening page tags:<head></head>.

Then, in the meta tag, we will set the name attribute to "viewport", and define the following values for the content attribute: width = device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required