博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
JavaScript Window Navigator 浏览器本身的信息
阅读量:6982 次
发布时间:2019-06-27

本文共 998 字,大约阅读时间需要 3 分钟。

window.navigator 对象包含有关访问者浏览器的信息。

Window Navigator

window.navigator 对象在编写时可不使用 window 这个前缀。

Navigator Object Properties

Property Description
Returns the code name of the browser
Returns the name of the browser
Returns the version information of the browser
Determines whether cookies are enabled in the browser
Returns the language of the browser
Determines whether the browser is online
Returns for which platform the browser is compiled
Returns the engine name of the browser
Returns the user-agent header sent by the browser to the server

Navigator Object Methods

Method Description
Specifies whether or not the browser has Java enabled
Removed in JavaScript version 1.2. Specifies whether the browser has data tainting enabled

实例:

警告:来自 navigator 对象的信息具有误导性,不应该被用于检测浏览器版本,这是因为:

  • navigator 数据可被浏览器使用者更改
  • 浏览器无法报告晚于浏览器发布的新操作系统

浏览器检测

由于 navigator 可误导浏览器检测,使用对象检测可用来嗅探不同的浏览器。

由于不同的浏览器支持不同的对象,您可以使用对象来检测浏览器。例如,由于只有 Opera 支持属性 "window.opera",您可以据此识别出 Opera。

例子:if (window.opera) {...some action...}

 

转载地址:http://ctvpl.baihongyu.com/

你可能感兴趣的文章
我的友情链接
查看>>
洛谷——P1403 [AHOI2005]约数研究
查看>>
为什么硬盘只能有四个主分区
查看>>
IT十八掌掌第二天课程总结
查看>>
职业SNS天际网:透视“屌丝文化” 解析当今职场
查看>>
Leetcode 29. Divide Two Integers
查看>>
Kubernetes 1.5集成heapster
查看>>
清华赵骥主任与CIO石海军研讨互联网信息化
查看>>
tnsname.ora文件解析
查看>>
论文:论项目的计划和监控
查看>>
linux启动引导过程 grub和mbr
查看>>
lnmp环境安装
查看>>
Codeforces Round #438 868A/B/C
查看>>
java.lang.ClassNotFoundException
查看>>
关于Console Application引用不到System.Web的问题
查看>>
调用百度翻译API接口功能
查看>>
表设置了自增后往里面插入不自增的id时的处理方法
查看>>
MySQL:MySQL日期数据类型、MySQL时间类型使用总结
查看>>
Proguard打包混淆报错:can't find superclass or interface
查看>>
2014美团笔试之寻找最短子串
查看>>