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 ...
随机推荐
- path 环境变量
path(环境变量)是dos以前的内部命令,windows继续沿用至今.用作运行某个命令的时候,本地查找不到某个命令或文件,会到这个声明的目录中去查找.一般设定java的时候为了在任何目录下都可以运行 ...
- 向CodeBlocks的Project中添加calss文件时,出现No such file or directory错误的解决方案
我们在CodeBlocks中编写程序时,一般要建立工程.现在建立工程first,然后建立类文件Person,并将其添加到first中, int main() { Person p; p.display ...
- VS2010使用TeeChart5的ColorGrid绘制一维距离像
绘制一维距离像原理:使用TeeChart控件中的ColorGrid显示(X,Y,Z)三维数据,X和Z分别代表一维距离像的x轴和y轴数据,Y代表对应的数值,以不同颜色显示. 1.注册TeeChart5 ...
- 14.Apache配置
环境: ↗ atl.example.com (192.168.1.101) ↗ www.e ...
- iphone document 图片存储和读取
转载自:http://longquan.iteye.com/blog/1669990 存: //此处首先指定了图片存取路径(默认写到应用程序沙盒 中) NSArray *paths = NSSearc ...
- ios特性访问器方法(setter和getter)
Employee.h @interface Employee:NSObject { int _employeeNumber; NSString *_name; Employee*_supervisit ...
- openerp 经典收藏 通过view实现字段的只读、隐藏操作(转载)
通过view实现字段的只读.隐藏操作 原文地址:http://cn.openerp.cn/view_groups/ 在OpenERP V7视图(ir.ui.view)多了一个非常有用的字段(group ...
- selenium-python iframe用法
易迅的登录方法,因为页面有很多iframe的内置框架,需要先逐级定位到登录元素所在的iframe才行 使用方法switch_to_frame('id-name') from selenium impo ...
- html css布局
这几天有点急于求成了,原来每一门技术都像大海,只有深入其中才发现它比看到的更要深广的多. 虽然忙里偷闲的看了HTML5,NODE.JS,JAVASCRIPT核心等许多东西,但是真正掌握的不足十分之一, ...
- posix 消息队列
注意 在涉及到posix消息的函数时, gcc 编译时要加-lrt参数, 如 gcc -lrt unpipc.c mqpack.c send.c -o send gcc -lrt unpipc.c m ...