javascript_获取浏览器属性
2016-12-02 10:53
351 查看
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之JS盒子模型常用的属性、定时器、获取浏览器计算后的属性样式值
- JavaScript学习笔记2:通过user-Agent获取浏览器和操作系统信息
- Javascript获取浏览器窗口大小(转)
- JavaScript 获取浏览器的显示区域大小信息
- JavaScript获取元素在浏览器画布中的绝对位置
- JavaScript 获取浏览器的显示区域大小信息
- javascript 的高级应用 获取浏览器的信息:使用navigator对象
- JavaScript获取浏览器信息
- Javascript获取各种浏览器可见窗口大小
- Javascript获取浏览器窗口大小 - Javascript 获取 浏览器 窗口 大小 JavaScript - 编程 学院 PHP开源 网窝设计BY WWW.WEBWOO.NET - 网窝网
- javascript 获取客户端浏览器的分辨率
- JavaScript获取元素在浏览器画布中的绝对位置
- JavaScript 获取浏览器的显示区域大小信息
- JavaScript 获取浏览器的显示区域大小信息
- javascript 获取页面高度(多种浏览器)(转)
- JavaScript获取元素在浏览器画布中的绝对位置
- javascript动态生成表格内容并设置属性,获取选中行的值
- window对象详解,JavaScript 获取浏览器的显示区域大小信息
- javascript 获取页面高度(多种浏览器)(转)
- Javascript 获取页面高度(多种浏览器)