YouTube magic that brings views, likes and suibscribers
Get Free YouTube Subscribers, Views and Likes

Get user location with javascript || Two methods (with/without permission)

Follow
Kode

Get the user's location by geolocation API and IP address with the help of JavaScript.

You can get the user's location with or without asking for permission to use their geolocation. I have shared two methods in this video:
1. Using Geolocation API WIth permission 100% accurate
2, Using IP address without permission Not so accurate.

Timestamp:
00:00 Preview
00:23 Using Geolocation API
13:58 Using IP address
17:02 Get the city/country from latitude and longitude
17:27 Outro


What Is the Geolocation API?
The JavaScript Geolocation API provides access to geographical location data associated with a user's device. This can be determined using GPS, WIFI, IP Geolocation and so on.

To protect the user's privacy, it requests permission to locate the device. If the user grants permission, you will gain access to location data such as latitude, longitude, altitude, and speed. You'll also get the accuracy of the acquired location data and the approximate time when the position was acquired.

Here are a few uses for geolocation:
Show user's position on a map
Get uptodate local information
Show local Pointsofinterest (POI) near the user
Enable Turnbyturn navigation (GPS)
Track a fleet or delivery vehicle
Tag photographs with a location

You can access the Geolocation API by calling the navigator.geolocation object. It grants the app access to the device's location.

getCurrentPosition: Returns the current location of the device.
watchPosition: A handler function that is automatically invoked when the device's location changes.
There are three possible arguments with these methods:

A success callback (required)
An error callback (optional)
An options object (optional)
How to Get User Location with getCurrentPosition()
You can use the getCurrentPosition method to get the user's current location. It sends an asynchronous request to the browser, asking for consent to share their location

WORTH CHECKING:

Hosting websites for free(playlist):
   • Free Web Hosting  

Making Facebook Clone using HTML & CSS:
   • How to create a website like Facebook...  

Send EMAIL without backend (using HTML):
   • How to send email using HTML only wit...  

Top 5 online CODE editors:
   • Top 5 Free Online Code Editors, cloud...  

AROUND THE WEB:

GitHub: @aashishpanthi
https://www.github.com/aashishpanthi

Instagram: @aashishpanthi11
  / aashishpanthi11  

Dev.to: @aashishpanthi
https://dev.to/aashishpanthi

Do not click this : https://bit.ly/352wEsG



Hey there lovely people, this channel is about WEB DEVELOPMENT && PROGRAMMING. Here, I upload videos once in every uncertain time . Mainly, videos are related to tutorials and informative videos.

#code #location #javascript

posted by nadrukke9e