浏览器对象由window, navigator, screen, location, document, history

window

//window不仅可以作为全局作用域,可以作为浏览器对象
window.innerWidth  //浏览器窗口的内部宽度和高度
window.innerHeight
window.outerWidth
window.outerHeight

navigator

//navigator表示浏览器的信息
navigator.appName:浏览器名称;
navigator.appVersion:浏览器版本;
navigator.language:浏览器设置的语言;
navigator.platform:操作系统类型;
navigator.userAgent:浏览器设定的User-Agent字符串

screen

//表示屏幕信息
screen.width:屏幕宽度,以像素为单位;
screen.height:屏幕高度,以像素为单位;
screen.colorDepth:返回颜色位数,如81624

location

//location对象表示当前页面的URL信息
location.href; //完整的浏览器信息
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'

document

//document对象就是整个DOM树的根节点

history

//history对象保存了浏览器的历史记录
back();
forward();

results matching ""

    No results matching ""