Geo-Locator

Geolocator.js is a utility for getting geo-location information, geocoding, address look-ups, distance & durations, timezone information and more. In this article, we will make use of the Geolocation API to get the geographical position of the user. Geo-location is accurate for devices with GPS (Global Positioning System).

Geolocation is also very useful for:

  • Up-to-date local information
  • To Guide the user to the destination
  • (GPS)

Requirements
1.Text editor
2.Browser support
3.Since Geo-location API is an HTML5 feature, make sure your doctype is HTML5.

The list of browsers given below fully support the Geolocation:
1.Google Chrome
2.Internet Explorer / Edge
3.Mozilla Firefox
4.Safari
6.Opera

Step 1: – Open up the text editor, create a file and name it as “geolocation.html”
Step 2: – Now add the following code into it.

Coding

Step 3: – Save the file and open it using your browser.

Geo-Locator Start

Step 4: – Click the Get Coords button to get the user coordinates. Since this API compromise user’s privacy, the position will not be available unless the user approves it.
Get Coords

Step 5: – Click the “Allow” button, to get the user coordinates as shown.
Allow Button

Important Note
Make sure you’re calling Geolocation APIs (such as geolocator.locate() and geolocator.watch()) from a secure origin (i.e. an HTTPS page). In Chrome 50, Geolocation API is removed from unsecured origins. Other browsers are expected to follow.

Learn How To Create A Geo-Locator Using The HTML API was last modified: by

Facebook Comments

Website Comments

  1. lithika jessi
    Reply

    This blog having the details of Processes running. The way of running is explained clearly. The content quality is really great. The full document is entirely amazing. Thank you very much for this blog.

  2. jessica
    Reply

    This idea is mind blowing. I think everyone should know such information like you have described on this post. Thank you for sharing this explanation.Your final conclusion was good. We are sowing seeds and need to be patiently wait till it blossoms.

Post a comment