Тёмный
No video :(

Getting the user's location with JavaScript (Geolocation API tutorial) 

Jonah Lawrence • Dev Pro Tips
Подписаться 8 тыс.
Просмотров 12 тыс.
50% 1

Using the Geolocation API to get the coordinates and address of a user with JavaScript
❤ Subscribe: bit.ly/Subscrib...
In this tutorial, I will show you how to use the navigator.geolocation API and the OpenCage API in JavaScript to get the user's coordinates, address, and city.
We will then use this to improve the weather app from last video
▶ Build a Weather App - • Build a Weather App wi...
We will make the weather app display the weather for the user's current location as soon as they open the page.
Follow me on Twitter for JavaScript tips and quizzes!
▶ / denvercoder1
👨‍💻 My code
▶ github.com/Den...
What topics should I cover next?
Let me know in the comments what you want to see next in my tutorials!
🖥 More Web Development tutorials
▶ • Web Development
💻 More tutorials
▶ • Tutorials
🙋‍♂️ Find me on other channels
Discord 🗨️ bit.ly/dpt-dis...
Twitter ✍ / denvercoder1
Github 👨‍💻 github.com/Den...
Sponsor 💞 github.com/spo...
One-time donation ☕ ko-fi.com/jlaw...
💖 SPONSORS 💖
Get your username or a link to your channel here by sponsoring on Github
▶ github.com/spo...
🎁 GET FREE STUFF WHILE SUPPORTING MY TUTORIALS
► bit.ly/jlawren...

Опубликовано:

 

28 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 26   
@lolibear
@lolibear 3 года назад
Thanks, this API for reverse geolocalization is amazing, i was recently looking for something like that
@Angelily100
@Angelily100 2 года назад
Thank so much for your help. I was wondering for your next video if you could show us how to integrate a future daily or hourly forecast of the city. :)
@iamstratos
@iamstratos 3 года назад
Simple and on point!
@DevProTips
@DevProTips 3 года назад
Thanks!
@Kurosaka
@Kurosaka 3 года назад
Idk how to code but will keep in mind
@alokitflux3829
@alokitflux3829 2 года назад
thanks......Love from India
@ChrisTian-ox5nr
@ChrisTian-ox5nr 2 года назад
This is fire ! Thank You!
@syahirahadni8647
@syahirahadni8647 Год назад
Thank you so much!
@elinordeniz
@elinordeniz Год назад
thanks, that was great
@AhmedOmar-yy9pf
@AhmedOmar-yy9pf 3 года назад
You are really smart
@DarkPurpleElixr
@DarkPurpleElixr 3 года назад
Do you know how to change the celsius to farenheight?
@DevProTips
@DevProTips 3 года назад
openweathermap.org/current "For temperature in Fahrenheit use units=imperial For temperature in Celsius use units=metric"
@abdelrahime7985
@abdelrahime7985 3 года назад
great great great job
@lavisanj-beingwomen5099
@lavisanj-beingwomen5099 2 года назад
Hi I am looking something to get geolocation of the user to create a region pop-up and redirection. and As a user when landing on a page that is outside my region, I would like to be notified that I am on a page outside my region.I am not looking for paid API. I am looking for something native code using javascript
@naturients8996
@naturients8996 3 года назад
it seems like getting current location doesn't work any more due to some change on Chrome. Could you suggest any alternative?
@DevProTips
@DevProTips 3 года назад
There are many alternatives that use the user's IP for geolocation although they might not be as accurate. One such example is GeoPlugin: making a request to "www.geoplugin.net/json.gp" should return an object containing the user's city. You can find many more similar APIs at github.com/public-apis/public-apis. You can do a find-in-page for "IP geolocation."
@lavisanj-beingwomen5099
@lavisanj-beingwomen5099 2 года назад
@@DevProTips are these free? or is there a limited user
@bharatigogoi1228
@bharatigogoi1228 3 года назад
It worked. Thank you. But can you please tell me how can I access this location outside of the function? I couldn't find any solution.
@bharatigogoi1228
@bharatigogoi1228 2 года назад
I found an alternate solution, just wanted to display the location so: var location=data.results[0].formatted; var message="Location: "; document.getElementById("loc").innerHTML = msg+location;
@lavisanj-beingwomen5099
@lavisanj-beingwomen5099 2 года назад
Hi Bharati. Can you help me with your github code link .I am looking something to get geo location of the user t create region pop up and redirection. and As a user when landing on a page that is outside my region, I would like to be notified that I am on a page outside my region.I am not looking for paid API. I am looking for something native code using javascript
@RAMGOPALGARUDKARBDS
@RAMGOPALGARUDKARBDS 3 года назад
hey i am unable to authoroze to the api key can uh help me out
@RAMGOPALGARUDKARBDS
@RAMGOPALGARUDKARBDS 3 года назад
the code isnt working it is showing error as unauthorized
@RAMGOPALGARUDKARBDS
@RAMGOPALGARUDKARBDS 3 года назад
plzz can uh help me buddy
@martinemmanual1094
@martinemmanual1094 2 года назад
Bro ur video is good But when ur doing something or u gonna teach something start from starch
@jaswardoddi1555
@jaswardoddi1555 2 года назад
Bro, source code
@Kurosaka
@Kurosaka 3 года назад
No fucking way.....
Далее
Get users location with Javascript geolocation
13:54
Просмотров 57 тыс.
Build a Weather App with HTML, CSS & JavaScript
37:36
Просмотров 322 тыс.
Reforged | Update 0.30.0 Trailer | Standoff 2
02:05
Просмотров 413 тыс.
5 JavaScript Concepts You HAVE TO KNOW
9:38
Просмотров 1,4 млн
40 APIs Every Developer Should Use (in 12 minutes)
12:23
Using the Geolocation API - JavaScript Tutorial
10:28
Google Maps JavaScript API Tutorial
27:27
Просмотров 1 млн
Build a Weather App With JavaScript
43:14
Просмотров 92 тыс.