在 JS 中,NAVIGATOR 对象表示浏览器的信息和状态。
// 获取系统和浏览器信息
console.log(window.navigator.userAgent); // 返回浏览器的用户代理字符串,包含有关浏览器厂商、版本号和操作系统的信息
console.log(window.navigator.platform); // 返回浏览器运行的操作系统平台(windows,mac……)
console.log(window.navigator.appName); // 返回浏览器的名称
console.log(window.navigator.appVersion); // 返回浏览器的版本信息
console.log(window.navigator.language); // 返回浏览器的首选语言
console.log(window.navigator.cookieEnabled);// 返回浏览器是否启用了 cookie