Window-Navigator对象

来源:互联网 发布:数控软件手机版 编辑:程序博客网 时间:2024/06/06 11:39

包含有关浏览器的信息

注意: 没有应用于 navigator 对象的公开标准,不过所有浏览器都支持该对象。

 1. appCodeName

一个只读字符串,声明了浏览器的代码名

google IE firefox safari opera true true true true true

`navigator.appCodeName`

document.write("浏览器代号: " + navigator.appCodeName);

 2. appName

可返回浏览器的名称

google IE firefox safari opera true true true true true

`navigator.appName`

document.write("浏览器名称: " + navigator.appName);

 3.appVersion

可返回浏览器的平台和版本信息。该属性是一个只读的字符串

google IE firefox safari opera true true true true true

`navigator.appVersion`

document.write("浏览器版本信息: " + navigator.appVersion);

 4.cookieEnabled

返回一个布尔值,如果浏览器启用了 cookie,该属性值为 true。如果禁用了 cookie,则值为 false

google IE firefox safari opera true true true true true

`navigator.cookieEnabled`

document.write("是否启用 Cookie: " + navigator.cookieEnabled);

 5.platform

只读的字符串,声明了运行浏览器的操作系统和(或)硬件平台

google IE firefox safari opera true true true true true

`navigator.platform`

document.write("硬件平台: " + navigator.platform);

 6.userAgent

只读的字符串,声明了浏览器用于 HTTP 请求的用户代理头的值

google IE firefox safari opera true true true true true

`navigator.userAgent`

document.write("用户代理: " + navigator.userAgent);

7. onLine

一个只读的布尔值,声明了系统是否处于脱机模式

 注释:在 IE 4+ 中,用户可以在浏览器中选择脱机工作的状态。当脱机工作被选后,系统就进入了脱机状态,内容将从缓存进行读取。

navigator.onLine

document.write(navigator.onLine)

1. javaEnabled

返回一个布尔值,该值指示浏览器是否支持并启用了 Java。如果是,则返回 true,否则返回 false。

google IE firefox safari opera true true true true true

navigator.javaEnabled()

document.write("启用Java: " + navigator.javaEnabled());

文档内容出自 W3cSchool和菜鸟教程,
如需查看更详细的有关内容 请登录 http://www.w3school.com.cn/ 和 http://www.runoob.com/