Navigator.UserAgent

It is not necessary to specify window before the navigator.userAgent object. Either window.navigator.userAgent or navigator.userAgent will produce the same result.

JavaScript Example

<script>// <![CDATA[
    document.write(navigator.userAgent);
// ]]></script>

PHP Example

<?php
    echo $_SERVER['HTTP_USER_AGENT'];
?>
CCBot/2.0 (https://commoncrawl.org/faq/)

Parsing the UserAgent String


Leave a Reply