JavaScript中浏览器提供的对象

window
window.innerWidth//获取窗口内部宽
window.innerHeight//获取窗口内部高,去除菜单栏,边框净宽高


window.outerHeight
window.outerWidth//浏览器窗口的整个宽高


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


screen//显示屏幕的信息
screen.width//屏幕宽px单位
screen.height//高
screen.colorDepth//颜色位数


location//获取当前页面的url信息
location.href//获取完整url信息
location.protocol; // 协议
location.host; // 主机
location.port; // 端口
location.pathname; // 路径
location.assign()//加载新页面
location.reload()//重新加载当前页面




document
document.title//设置页面标题
document.getElementById()//通过id获取元素
document.getElementsByTagName()//通过标签名获取元素
document.cookie//获取当前页面的cookie信息

猜你喜欢

转载自blog.csdn.net/qq_29002631/article/details/80335395