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 ...
随机推荐
- 如何让linux定时任务crontab按秒执行
如何让linux定时任务crontab按秒执行? linux定时任务crontab最小执行时间单位为分钟如果想以秒为单位执行,应该如何设置呢?思路 正常情况是在crontab中直接定义要执行的任务,现 ...
- iOS开发 Masonry的简单使用
首先,在正式使用Masonry之前,我们先来看看在xib中我们是如何使用AutoLayout 从图中我们可以看出,只要设置相应得局限,控制好父视图与子视图之间的关系就应该很ok的拖出你需要的需 ...
- 高级智能研究计划(IARPA):大脑皮层建模
哈哈,看到了一篇我最感兴趣的领域的新闻报导,可以深挖里面的各种细节. Quanta Magazine: Illuminating Science - 原文出处 卡内基·梅隆大学 - Tai Sing ...
- iOS中的translucent和automaticallyAdjustsScrollViewInsets用法
关于这两个属性我长话短说 具体的可以更具具体情况来设置: translucent用法 automaticallyAdjustsScrollViewInsets用法 translucent用法 iOS7 ...
- python中元组(tuple)的用法
t=(1,2,3) t=() t=(1,)#元组中只有一个值,需在值后面加上,不然会当int型识别 te.count(1) te.index(2) te[::-1]#关于切片跟列表一样的 tuple的 ...
- 类库、委托、is as运算符、泛型集合
类库: 说白了,就是让别人调用你写的方法,并且不让别人看到你是怎么实现的. 如果有功能你不会做,需要别人帮忙,那么你的同事可以帮你写好一个类,然后你来调用这个类中的方法,完成你的项目. 1.C#源代码 ...
- 如何做出header,footer固定定位后让main主体部分可以滑动,在微信浏览器中滑动到最后不出现黑边的情况
<!doctype html> <html> <head> <meta charset="utf-8"> </ ...
- Five More Hacker Tools Every CISO Should Understand
As we mentioned in the first article, Top Five Hacker Tools Every CISO Should Understand, the role o ...
- sqoop将关系型数据库的表导入hive中
1.sqoop 将关系型数据库的数据导入hive的参数说明:
- centos lamp
一.安装 MySQL 首先来进行 MySQL 的安装.打开超级终端,输入: [root@localhost ~]# yum install mysql mysql-server 安装完毕,让 MySQ ...