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 ...
随机推荐
- ThinkPHP中的视图
ThinkPHP中的视图View 1.什么是视图View 所谓的视图就是用户可视化操作界面. 2.视图View组成 view类(模板引擎类似Smarty) 模板文件(html模板) 3.视图的定义 默 ...
- 【leetcode】13. Roman to Integer
题目描述: Given a roman numeral, convert it to an integer. 解题分析: 这道题只要百度一下转换的规则,然后着这解释写代码即可.实现上并没有什么难度,直 ...
- nyoj71--独木舟上的旅行
描述 进行一次独木舟的旅行活动,独木舟可以在港口租到,并且之间没有区别.一条独木舟最多只能乘坐两个人,且乘客的总重量不能超过独木舟的最大承载量.我们要尽量减少这次活动中的花销,所以要找出可以安置所有旅 ...
- 一些常用的字符串hash函数
unsigned int RSHash(const std::string& str) { unsigned int b = 378551; unsigned int a = 63689; u ...
- OSX 上初步尝试 asp.net 5
去年微软最令开源狗界振奋的消息就是 ASP.NET 的开放与开源这一消息了. 根据微软的介绍,与我之前的一些总结,可以看到 ASP.NET 以及 .NET 平台会有下面几个变化: 代码使用 Apach ...
- fpm打包redis3.0.7
1.安装redis tar -xf redis-3.0.7.tar.gz -C /usr/local cd /usr/local && mv redis-3.0.7 redis cd ...
- 实现简单的cp命令
在Linux下实现简单的cp命令.这是<APUE>第四章的其中一道练习题. 其实思路很简单,弄清规则就行了.规则1:源文件必须得存在,否则出错:规则2:目的文件若不存在则创建,若存在,则提 ...
- Tomcat部署web应用的方式
对Tomcat部署web应用的方式总结,常见的有以下四种: 1.[使用控制台部署] 访问Http://localhost:8080,并通过Tomcat Manager登录,进入部署界面即可. 2.[利 ...
- Ubontu使用技巧
1. ctrl + alt + T => 打开命令行窗口 2. sudo su => 开启root权限 3. cd => 打开文件夹 4. cd "Program F ...
- 在项目中 background transiton 带来的"便利"与“坑”
本文就两个例子跟大家分享一下background-image与background-size的渐变(transition)所带来的方便与“深坑” 首选,说说这东西好的地方,有时候在做PC项目的时候,可 ...