js_浏览器对象

1. 浏览器对象

window

  • window对象不但充当全局作用域,而且表示浏览器窗口
    • 所有全局js对象,函数和变量自动成为window对象的成员
    • 全局变量时window对象的属性
    • 全局函数是window对象的方法  
  • innerWidth : 浏览器内部宽度。 innerHeight :浏览器内部高度
  • outerWidth / outerHeight  整个浏览器的宽高

navigator

  • 表示浏览器信息
  • navigator.appName :  浏览器名称
  • navigator。appVersion : 浏览器版本
  • navigator.language : 浏览器设置的语言
  • navigator.platform : 操作系统的类型
  • navigator.userAgent : ua

screen

  • screen.width : 屏幕宽度
  • screen.height : 屏幕高度
  • screen.colorDepth : 返回颜色位数

location : 当前页面的url信息 

  • location.href
  • location.protocol
  • location.host
  • location.port
  • location.pathname
  • location.search
  • location.hash

document

  • 表示当前页面,是整个dom的根结点
  • document.title  
  • document.getElementById()
  • document.getElementTagName()  
  • document.cookie  ; 'v=123; remember=true; prefer=zh'

history

  • history.back()  后退
  • history.forward()  前进
  •           
posted @ 2019-11-04 14:50  眼镜儿  阅读(167)  评论(0编辑  收藏  举报