代码示例:(标识:eg_js_navigator_userAgent)
<!DOCTYPE html>
<html>
<body>

<h1>Navigator 对象</h1>

<p>userAgent 属性返回浏览器发送给服务器的用户代理标头:</p>

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML =
navigator.userAgent;
</script>

</body>
</html>
运行结果: