# Get user geolocation on submit

**URL:** <https://forum.djangoproject.com/t/get-user-geolocation-on-submit/29891>\
**Category:** Getting Started\
**Created:** [April 6, 2024, 5:11am UTC](https://forum.djangoproject.com/t/get-user-geolocation-on-submit/29891 "2024-04-06T05:11:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![callmejg147](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/callmejg147/32/17973_2.png) [@callmejg147](https://forum.djangoproject.com/u/callmejg147)\
**Post date:** [April 6, 2024, 5:11am UTC](https://forum.djangoproject.com/t/get-user-geolocation-on-submit/29891/1 "2024-04-06T05:11:05Z")

</div>

Hi,  
I am trying to create a webapp for a finance company to maintain records of their collection agents. One of their main requirement is to know the agent’s location, like a tracking system. Their admins want to know where the agents are all the time. Agents would be using the webapp on the mobile or a tablet so i am guessing django should be able to access the phone’s location. Also when an agent enters a collection in the webapp, a location of where the collection was made should also be added to the database.  
Basically if know how to get the current location i could try and figure out a way to do the rest. As i went through the internet for a solution, i found certain APIs and tools like GeoIP, the best they return is the city and even that is a wild guess based on the ip address. What i would like to get is a more precise location using the mobile’s location.  
This is a new concept for me, i’d really appreciate it if someone can help me with this.

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [April 6, 2024, 11:22am UTC](https://forum.djangoproject.com/t/get-user-geolocation-on-submit/29891/2 "2024-04-06T11:22:20Z")

</div>

Django can’t get this information because _it_ is running on the server, but JavaScript can - if it’s granted permission by the user to do so.

However, there _are_ a lot of caveats associated with this. I suggest you start with the docs at [Geolocation API - Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API).

You’ll want to know what degree of accuracy is required. Also be aware that there’s a wide range in accuracy between brands and models of phones.

If you’re write a native app for the mobile environment, you’re likely going to get more accurate information. (At least we found this to be true about 5 years ago when we did some work in this area.)
