window对象
浏览器弹出框:open("http://163.com","我的网页","width=200,height=200")
视窗宽高:nnerWidth,innerHeight
和document.documentElement.clientWidth clienHeight一样
浏览器窗口宽高:outerWidth,outerHeight
获取当前窗口相对屏幕的坐标:screenLeft,screenTop
screenX,screenY
Location对象
重载:location.reload();
跳转页面:location.href
location.assign()
location.replace()
区别:location.href除了跳转页面,还可以获取当前页面的网址,有历史记录;
location.assign()只能跳转页面,有历史记录;
location.replace()替换当前页面,也是跳转页面,没有历史记录。
location.hash:获取地址栏中#后面的内容,也就是锚点标记名
location.search:获取地址栏中?后面的内容,?号后面一般是访问地址的参数
location.pathname:地址栏中文件路径和名称;
location.port:地址栏中的端口号;
location.protocol:地址栏中的协议;
location.hostname:地址栏中的域名;
History对象
history.back():回退
history.forward():前进
history.go(1):跳转到第几个负数是回退,正式是前进,0是刷新页面;
Screen对象
全屏幕宽高:screen.width,screen.height;
不带任务栏的屏幕宽高:screen.availWidth,screen.availHeight;
navigator 浏览器信息
用户浏览器信息:navigator.userAgent;