Subscribe / Unsubscribe Enewsletters | Login | Register

Pencil Banner

Pinpoint users' locations via JavaScript and the Web's Geolocation API

John Duckett | Aug. 14, 2014
Want to offer extra functionality to your users based on where they are? Here's how.

You've probably visited websites where you've been asked to share your location; if you agree, the site determines where you are and then typically gives you extra functionality such as directions or local weather.

Sites can pinpoint your location (if you give permission) by implementing the Geolocation API, a standard adopted by the World Wide Web Consortium that's available on recent versions of platforms including IE, Firefox, Safari, Chrome, Opera, iOS and Android.

In this PDF download, you'll see how just a few lines of JavaScript are needed to discover a user's location. (This PDF is excerpted with permission from the publisher, Wiley, from JavaScript & jQuery: Interactive front-end Web development by John Duckett. Copyright 2014 all rights reserved.


Sign up for CIO Asia eNewsletters.