🧭 Navigator Object
Last Updated: 26th October 2025
The Navigator Object provides information about the browser and operating system in which JavaScript is running.
It is a property of the window object, so you can access it as window.navigator or simply navigator.
Hinglish Tip 🗣:
navigatorbrowser ka “ID card” hai — ye batata hai ki kaunsa browser, platform, language, aur network use ho raha hai.
🧩 Common Properties of Navigator
| Property | Description | Example |
|---|---|---|
| appName | Browser name | navigator.appName |
| appVersion | Browser version details | navigator.appVersion |
| userAgent | Browser identification string | navigator.userAgent |
| platform | Operating system (Windows, Linux, Mac, etc.) | navigator.platform |
| language | Browser language | navigator.language |
| onLine | Boolean — true if browser is online | navigator.onLine |
| geolocation | Used to get user’s location (latitude, longitude) | navigator.geolocation.getCurrentPosition() |
Example
console.log("Browser Name: ", navigator.appName);
console.log("Browser Version: ", navigator.appVersion);
console.log("User Agent: ", navigator.userAgent);
console.log("Platform: ", navigator.platform);
console.log("Language: ", navigator.language);
console.log("Online Status: ", navigator.onLine);
User Current Location
navigator.geolocation.getCurrentPosition(
(position) => {
console.log("Latitude: " + position.coords.latitude);
console.log("Longitude: " + position.coords.longitude);
},
(error) => {
console.error("Error: " + error.message);
}
);
Hinglish Tip 🗣: Geolocation tabhi kaam karega jab user permission de. Browser popup me “Allow Location Access” dena padta hai.
💡 Key Points
- navigator gives browser and system info.
- geolocation helps find user’s current coordinates.
- onLine is useful for detecting internet connection.
- userAgent helps in browser detection (like Chrome, Edge, Firefox).
💡 Quick Practice
- Display your browser’s language and platform in the console.
- Check whether you are online using navigator.onLine.
- Try printing your current location (with permission).