Pinpoint Users' Locations via JavaScript and the Web's Geolocation API

FREE

Become An Insider

Sign up now and get free access to hundreds of Insider articles, guides, reviews, interviews, blogs, and other premium content from the best tech brands on the Internet: CIO, CSO, Computerworld, InfoWorld, IT World and Network World Learn more.

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.

To continue reading, please begin the free registration process or sign in to your Insider account by entering your email address:
Insider Resume Makeover: How (and When) to Break the Rules
Join the discussion
Be the first to comment on this article. Our Commenting Policies