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信息
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值