A simple JavaScript project that detects the user's location using the browser's Geolocation API and displays it on the webpage.
This project is beginner-friendly and demonstrates how to work with browser permissions, JavaScript APIs, and DOM updates.
(If deployed, add link here) Example: https://deepaktecz.github.io/Detect-User-Location/
- Detect user location using Geolocation API
- Show latitude and longitude
- Handle permission requests
- Error handling for denied location access
- Beginner-friendly JavaScript code
- HTML
- CSS
- JavaScript
- Browser Geolocation API
Detect-User-Location │ ├── index.html ├── style.css ├── script.js └── README.md
yaml Copy code
The browser asks the user for location permission. If permission is granted, JavaScript retrieves:
- Latitude
- Longitude
Using:
navigator.geolocation.getCurrentPosition()
Then the location is displayed on the webpage.
▶️ Run Locally
Clone the repository:
bash
Copy code
git clone https://github.com/deepaktecz/Detect-Usre-Location.git
Open the project folder:
bash
Copy code
cd Detect-Usre-Location
Open index.html in your browser.