首页 > 其他分享 >浏览器提供的对象

浏览器提供的对象

时间:2022-11-02 09:56:26浏览次数:81  
标签:浏览器 对象 提供 获取 window location navigator document

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信息

标签:浏览器,对象,提供,获取,window,location,navigator,document
From: https://www.cnblogs.com/Sultan-ST/p/16850014.html

相关文章