userAgent 属性是一个只读的字符串,声明了浏览器用于 HTTP 请求的用户代理头的值。.
navigator.userAgent
所有主要浏览器都支持 userAgent 属性
您的浏览器发送的用户代理标题:
<script>
document.write("User-agent header sent: " + navigator.userAgent);
</script>
以上实例输出结果:
运行一下 »
User-agent header sent: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)