Table of Contents
The window.navigator object contains information about the visitor's browser. It can be used to detect browser properties like cookies enabled, language, platform, and user agent.
The navigator.cookieEnabled property returns true if cookies are enabled in the browser:
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Window Navigator</h2>
<p>From w3schools.com, Experiment by Teeratus_R</p>
<h4>Browser Cookies</h4>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
"navigator.cookieEnabled: " + navigator.cookieEnabled;
</script>
</body>
</html>

Result View Example
The navigator.language property returns the browser's language:
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Window Navigator</h2>
<p>From w3schools.com, Experiment by Teeratus_R</p>
<h4>The Browser Language</h4>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
"navigator.language: " + navigator.language;
</script>
</body>
</html>

Result View Example
The navigator.onLine property returns true if the browser is online:
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Window Navigator</h2>
<p>From w3schools.com, Experiment by Teeratus_R</p>
<h4>Is The Browser Online?</h4>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
"navigator.onLine: " + navigator.onLine;
</script>
</body>
</html>

Result View Example
The navigator.userAgent property returns the user-agent string sent by the browser:
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Window Navigator</h2>
<p>From w3schools.com, Experiment by Teeratus_R</p>
<h4>The Browser Agent</h4>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
"navigator.userAgent: " + navigator.userAgent;
</script>
</body>
</html>

Result View Example
The navigator.platform property returns the browser platform (operating system):
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Window Navigator</h2>
<p>From w3schools.com, Experiment by Teeratus_R</p>
<h4>The Browser Platform</h4>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
"navigator.platform: " + navigator.platform + "<br><br>" +
"All navigator properties:<br>" +
"cookieEnabled: " + navigator.cookieEnabled + "<br>" +
"language: " + navigator.language + "<br>" +
"onLine: " + navigator.onLine + "<br>" +
"platform: " + navigator.platform + "<br>" +
"appName: " + navigator.appName + "<br>" +
"appVersion: " + navigator.appVersion + "<br>" +
"userAgent: " + navigator.userAgent + "<br>" +
"product: " + navigator.product + "<br>" +
"appCodeName: " + navigator.appCodeName + "<br>" +
"javaEnabled: " + navigator.javaEnabled();
</script>
</body>
</html>

Result View Example
Document in project
You can Download PDF file.