JAVASCRIPT Tutorial
The 'JS Navigator' object provides information about the user's web browser and its capabilities. It's a valuable tool for customizing the user experience, optimizing performance, and detecting browser-specific issues.
navigator
global variable to access the object.navigator.userAgent
to retrieve the user agent string.navigator.cookieEnabled
and navigator.serviceWorker
to check for specific features.navigator.appName
, navigator.appVersion
, and navigator.platform
to get details about the browser.navigator.language
to determine the user's preferred language.console.log(`User Agent: ${navigator.userAgent}`); // Logs the user agent string
console.log(`Cookies Enabled: ${navigator.cookieEnabled}`); // Logs true if cookies are enabled
console.log(`Browser Name: ${navigator.appName}`); // Logs the browser name (e.g., "Chrome")
console.log(`Browser Version: ${navigator.appVersion}`); // Logs the browser version (e.g., "102.0.5005.63")
console.log(`Platform: ${navigator.platform}`); // Logs the operating system (e.g., "Win32")
console.log(`Language: ${navigator.language}`); // Logs the user's preferred language (e.g., "en-US")
Using 'JS Navigator' allows you to: