javascript_获取浏览器属性
navigator.appName:浏览器名称;
navigator.appVersion:浏览器版本;
navigator.language:浏览器设置的语言;
navigator.platform:操作系统类型;
navigator.userAgent:浏览器设定的User-Agent字符串。
'use strict';
alert('appName = ' + navigator.appName + '\n' +
'appVersion = ' + navigator.appVersion + '\n' +
'language = ' + navigator.language + '\n' +
'platform = ' + navigator.platform + '\n' +
'userAgent = ' + navigator.userAgent);

screen.width:屏幕宽度,以像素为单位;
screen.height:屏幕高度,以像素为单位;
screen.colorDepth:返回颜色位数,如8、16、24。
'use strict';
alert('Screen size = ' + screen.width + ' x ' + screen.height);

location.protocol; // 'http'
location.host; // 'www.example.com'
location.port; // '8080'
location.pathname; // '/path/index.html'
location.search; // '?a=1&b=2'
location.hash; // 'TOP'
'use strict';
if (confirm('重新加载当前页' + location.href + '?')) {
location.reload();
} else {
location.assign('/discuss'); // 设置一个新的URL地址
}

'use strict';
// 获取当前浏览器title
alert(document.title)
// 更改title
document.title = '百哥么么哒';

// 获取cookie
alert(document.cookie)

javascript_获取浏览器属性的更多相关文章
- 快捷获取浏览器(navigator对象)的全部属性
理论: navigator对象包含关于web浏览器的信息,浏览器的类型,版本信息都可以从该对象获取. 属性 说明 appCodeName 浏览器代码说明 appName 浏览器名称 appVe ...
- 原生JS 获取浏览器、窗口、元素等尺寸的方法及注意事项
一.通过浏览器获得屏幕的尺寸 screen.width screen.height screen.availHeight //获取去除状态栏后的屏幕高度 screen.availWidth //获取去 ...
- JS获取浏览器名和版本信息
Navigator 对象包含有关浏览器的信息. Navigator 对象属性和方法: <html> <head> <title>JS完整获取浏览器信息</ti ...
- JS 获取浏览器窗口大小
JS 获取浏览器窗口大小 <script> // 获取窗口宽度 if (windows.innerWidth) { winWidth = windows.innerWidth; } els ...
- js中获取css属性
直接获取 window.onload = function() { var but = document.getElementById('button'); var div = document.ge ...
- JS 获取浏览器和屏幕宽高等信息代码
JS 获取浏览器和屏幕宽高等信息. 网页可见区域宽:document.body.clientWidth 网页可见区域高:document.body.clientHeight 网页可见区域宽:doc ...
- js获取浏览器高度和宽度值,尽量的考虑了多浏览器。
js获取浏览器高度和宽度值,尽量的考虑了多浏览器. IE中: document.body.clientWidth ==> BODY对象宽度 document.body.clientHeight ...
- js获取浏览器基本信息:document.body.clientWidth/clientHeight/scrollWidth/scrollTop。(转)
js获取浏览器基本信息:document.body.clientWidth/clientHeight/scrollWidth/scrollTop. 分类: js.jquery.ext.js技术2011 ...
- JS获取浏览器可视区域尺寸
本文所说的是浏览器窗口的可视区域大小,不是浏览器窗口大小,也非页面尺寸. 在没有声明DOCTYPE的IE中,浏览器显示窗口大小只能以下获取: document.body.offsetWidth doc ...
随机推荐
- Uncaught SecurityError: Failed to execute 'replaceState' on 'History': A history state object with
stackoverflow上的的解决方法:Install a web server and load your HTML document from there.
- matlab实现感知机算法--统计学习小灶
clear all; clc; %% %算法 %输入:训练数据集T = {(x1,y1),(x2,y2),...,(xn,yn)};学习率η %输出:w,b;感知机模型f(x) = sign(w*x+ ...
- 使用C语言将IE收藏夹生成HTML
IE收藏夹里收藏的链接很多,查找也不方便,使用C编写一个小工具,可以将收藏夹里的链接文件生成到一个HTML文件上. 源码还有许多地方需要优化,后续我会优化,先分享出来.目的主要是为了练习C语言,这个代 ...
- C#窗体自定义控件
using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; u ...
- iOS开发数据库篇—FMDB数据库队列
iOS开发数据库篇—FMDB数据库队列 一.代码示例 1.需要先导入FMDB框架和头文件,由于该框架依赖于libsqlite库,所以还应该导入该库. 2.代码如下: // // YYViewContr ...
- [ie兼容]ie7 margin-bottom失效
有时候子元素设置了margin,父元素也设置了margin,父元素的margin在ie7下会失效(包括padding) 解决方法:父容器加属性overflow:hidden;zoom:100%;
- GIT(分布式版本控制系统)
Git是一款免费.开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目.[1] Git的读音为/gɪt/. Git是一个开源的分布式版本控制系统,用以有效.高速的处理从很小到非常大的项目版本 ...
- 项目中使用oracle序列
在数据库设计的时候我们可以将表的ID定义为String 然后我们可以使用序列来得到唯一的ID 手写一个mapper: <?xml version="1.0" encoding ...
- FlashBuilder使用
打开调用层次视图,显示当前类.变量被谁调用,右侧显示调用位置. ctrl+alt+H 快捷键 导航即浏览菜单中,单击. 右键单击打开. 为组件生成事件处理函数 组件==控件,按钮等.右侧属性,又叫属性 ...
- Request.Form()的使用
在CS文件中获得对应页面中的下拉框DropDownList_sitebranch值可以有以下几种方法获得: siteInfo.FZJGID = DropDownList_sitebra ...