Skip to content

deepaktecz/Detect-Usre-Location

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Detect User Location 🌍

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.


🚀 Live Demo

(If deployed, add link here) Example: https://deepaktecz.github.io/Detect-User-Location/


📌 Features

  • Detect user location using Geolocation API
  • Show latitude and longitude
  • Handle permission requests
  • Error handling for denied location access
  • Beginner-friendly JavaScript code

🛠 Tech Stack

  • HTML
  • CSS
  • JavaScript
  • Browser Geolocation API

📂 Project Structure

Detect-User-Location │ ├── index.html ├── style.css ├── script.js └── README.md

yaml Copy code


⚙️ How It Works

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.

About

This project detects the user’s current location using the browser’s Geolocation API and displays the latitude and longitude on the webpage. It is a beginner-friendly JavaScript project that demonstrates how to work with browser permissions and APIs.

Topics

Resources

Stars

Watchers

Forks

Contributors