Location
- location.href 返回或者设置当前页面的地址,链接
- window.open(‘网址链接’)
- location.href = location.href; 刷新页面!
location.reload(); 刷新页面!
history
- history.back(); 上一个网页
- history.forward() 下一个网页
- history.go(-1) 上一个网页
- history.go(-2) 上两个网页
- history.go(1) 下一个网页
navigator
可以返回流量拿起信息 但是兼容性很差
navigator.userAgent 当前浏览器的相关信息,可以返回浏览器用户信息 ,各个浏览器信息都有这个,返回值可以查看使用的浏览器是什么浏览器
谷歌 chrome
火狐 firefox
ie MS IE
搜狗 Chrome
各种宽度值
screen:返回电脑显示器的相关信息
- screen.width 浏览器窗口宽
screen.height 浏览器窗口高 - screenTop = screenX 浏览器距离屏幕上边的距离
screenLeft = screenY 浏览器距离屏幕左边的距离 - innerWidth 浏览器内容宽
innerHeight 浏览器内容高
元素:宽高信息
- offsetLeft/offsetTop
计算元素相对父级的偏移距离
包括left/top、margin,不包括translate - offsetWidth/offsetHeight
包括width、padding、border,不包括margin - clientWidth/clientHeight
//width + padding 不包括margin border