Window navigator.userAgent property
- 上一页 taintEnabled()
- 下一页 appCodeName
- 返回上一层 window navigator
Definition and usage
userAgent
The property returns the user-agent header that the browser sends to the server.
userAgent
The property is read-only.
The returned value contains information about the browser name, version, and platform.
The Web standard recommends that browsers provide as little header information as possible. Never assume that this property will remain unchanged in future browsers.
Example
Example 1
Get navigator.userAgent:
let agent = navigator.userAgent;
Example 2
Display all navigator properties:
let text = "<p>Browser CodeName: " + navigator.appCodeName + "</p>" + "<p>Browser Name: " + navigator.appName + "</p>" + "<p>Browser Version: " + navigator.appVersion + "</p>" + "<p>Cookies Enabled: " + navigator.cookieEnabled + "</p>" + "<p>Browser Language: " + navigator.language + "</p>" + "<p>Browser Online: " + navigator.onLine + "</p>" + "<p>Platform: " + navigator.platform + "</p>" + "<p>User-agent header: " + navigator.userAgent + "</p>";
ວິທະຍານ
navigator.userAgent
ຜົນກະທົບ
ຊະນິດ | ອະທິບາຍ |
---|---|
ສາຍຄວາມ | ຫົວຂໍ້ຜູ້ອອກຄຳສັ່ງບັນນາທິການ |
ການສະໜັບສະໜູນ
所有浏览器都支持 navigator.userAgent
:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
- 上一页 taintEnabled()
- 下一页 appCodeName
- 返回上一层 window navigator