JS DOM: Get User Agent, Cookie Enabled Status

By Xah Lee. Date: . Last updated: .

Here is how to find the browser (User Agent) used, and Cookie Enabled Status.

The object navigator stores info about browser.

your browser status

code

<ul>
<li><b>navigator.userAgent:</b> <span id="xuserAgent"></span></li>
<li><b>navigator.cookieEnabled:</b> <span id="xcookieEnabled"></span></li>
</ul>
{
  document.getElementById("xuserAgent").textContent = navigator.userAgent;
  document.getElementById("xcookieEnabled").textContent = navigator.cookieEnabled;
}

JS DOM, cookies and web storage