js_浏览器对象

狂风中的少年 提交于 2019-12-03 10:54:43

1. 浏览器对象

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()  前进
  •           
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!