Browser detect
A useful but often overrated JavaScript function is the browser detect. Sometimes you want to give specific instructions or load a new page in case the viewer uses, for instance, Safari.
If you're new to JavaScript, don't use browser detects. You don’t need them. Please read the object detection page first.
Use WhichBrowser
This page used to contain my own browser detect script, but I found that I do not have enough time to keep it up to date. Therefore I removed it.
I advise you to use WhichBrowser. It’s up-to-date, and contains a treasure trove of mobile information.
If you use my old script I advise you to switch to WhichBrowser.
navigator
Below you see the objects contained by the object navigator. These variables can be read out and give information about the browser and computer of your users.
navigator.geolocation = [object Geolocation]
navigator.webkitPersistentStorage = [object StorageQuota]
navigator.webkitTemporaryStorage = [object StorageQuota]
navigator.doNotTrack = null
navigator.onLine = true
navigator.product = Gecko
navigator.appCodeName = Mozilla
navigator.userAgent = Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36
navigator.platform = MacIntel
navigator.appVersion = 5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36
navigator.appName = Netscape
navigator.vendorSub =
navigator.vendor = Google Inc.
navigator.productSub = 20030107
navigator.cookieEnabled = true
navigator.mimeTypes = [object MimeTypeArray]
navigator.plugins = [object PluginArray]
navigator.language = en-US
navigator.javaEnabled = function javaEnabled() { [native code] }
navigator.getStorageUpdates = function getStorageUpdates() { [native code] }
navigator.registerProtocolHandler = function registerProtocolHandler() { [native code] }
navigator.webkitGetGamepads = function webkitGetGamepads() { [native code] }
navigator.webkitGetUserMedia = function webkitGetUserMedia() { [native code] }
navigator.vibrate = function vibrate() { [native code] }
Browser detect的更多相关文章
- Window.navigator
定义和用法 userAgent 属性是一个只读的字符串,声明了浏览器用于 HTTP 请求的用户代理头的值. 一般来讲,它是在 navigator.appCodeName 的值之后加上斜线和 navig ...
- DamonOehlman/detect-browser
https://github.com/DamonOehlman/detect-browser detect-browser This is a package that attempts to det ...
- MetaMask/metamask-extension-provider
用来探测你的浏览器中有没有安装metamask插件 https://github.com/MetaMask/metamask-extension-provider MetaMask Extension ...
- JS: How to detect my browser version and operating system using JavaScript?
Example: 1. for IE 11, navigator.userAgent returns "Mozilla/5.0 (Windows NT 6.1; WOW64; Tride ...
- python flask detect browser language
python flask detect browser language No problem. We won't show you that ad again. Why didn't you l ...
- javascript: detect mobile devices or browser
http://detectmobilebrowsers.com/ http://hgoebl.github.io/mobile-detect.js/ http://www.hand-interacti ...
- PHP: Browser, Operating System (OS), Device, and Language Detect
https://github.com/sinergi/php-browser-detector Device.php: <!DOCTYPE html> <html> <h ...
- C#检测浏览器类型 Detect Browser
private void Button1_Click(object sender, System.EventArgs e) { System.Web.HttpBrowserCapabilities b ...
- 解决ubuntu 14.04 下eclipse 3.7.2 不能启动,报Could not detect registered XULRunner to use 或 org.eclipse.swt.SWTError: XPCOM 等问题的处理
对于eclipse 3.7.2在ubuntu 14.04下不能启动,需要在 eclipse/configuration 目录下的config.ini文件内增加一行org.eclipse.swt.bro ...
随机推荐
- 链接与ELF文件格式的复习
在这里复习一下链接的知识: 什么是链接(linking):把源代码形成的模块独立编译后组装成一个整体的的过程叫做链接. 链接主要过程包括:地址和空间分配(address and storage all ...
- RHEL(RedHat Enterprise Linux)5/6 ISO镜像下载
本文贴出了RHEL(RedHat Enterprise Linux)发行版本中常用的服务器版本的ISO镜像文件,供大家下载学习使用,贴出的版本有RedHat Enterprise Linux(RHEL ...
- ★Linux磁盘配额的使用 ★——牛刀小试
磁盘配额的作用:限制普通用户使用磁盘的空间和创建文件的个数,不至于因为个别人的浪费而影响所有人的使用 需要用户程序quota软件包 #rpm -qa | grep quota 查看quota软件包安 ...
- C# 语言如何获取json格式的数据,不用javascript用c#实现。。。
{'state' : 1,'data':{'list':[{'id': 123, 'name': '诸葛天邪','level': 10,'country': 1,}]}} 比如我要获取里面的 id 该 ...
- IOS_设置启动图片若干问题
在做项目时, 发现设置了LaunchImage时发现一些问题: 1. 启动图片的设置可以通过两种方法: 1) 通过在LaunchScreen里放入ImageView 并设置图片, 这种方法的好处在于不 ...
- 从省市区多重级联想到的,react和jquery的差别
在我们的前端项目里经常会用到级联的select,比如省市区这样.通常这种级联大多是动态的.比如先加载了省,点击省加载市,点击市加载区.然后数据通常ajax返回.如果没有数据则说明到了叶子节点. 针 ...
- Python脚本控制的WebDriver 常用操作 <二十七> 文件下载
测试用例场景 webdriver允许我们设置默认的文件下载路径.也就是说文件会自动下载并且存在设置的那个目录中. Python脚本 测试用Python代码: # coding=gbk ''' Crea ...
- 测试使用Windows Live Writer
目前是在win7系统下面使用的,曾经在winxp下去配置,却失败了,难道不支持xp? Windows Live Writer好像不支持代码关键字高亮显示啊. int main(void) { prin ...
- 【转】微软MVP攻略 (如何成为MVP?一个SQL Server MVP的经验之谈)
一.本文所涉及的内容(Contents) 本文所涉及的内容(Contents) 初衷 什么是微软MVP? 成为微软MVP的条件? 如何成为微软MVP? (一) 申请时间划分 (二) 前期准备 (三) ...
- BI的核心价值[转]
BI的核心价值是辅助决策,从一个洁净的数据源中自动提取有价值的数据进行分析,从而成为重要商业决定的决策基础.但在国内,洁净的数据源不易得到,很多情况下都需要进行数据清洗,所以BI的应用受到很大程度的抑 ...