BOM操做(Browser Object Model:浏览器对象模型)

  1. JS基础知识,规定语法(ECMA 262 标准)
  2. JS Web API,网页操做的API(W3C标准)
JS Web API:
  • DOM
  • BOM
  • 事件绑定
  • ajax
  • 存储

BOM知识点

  • navigator(浏览器的信息)
  • screen(屏幕的信息)
  • location(url的信息)
  • history(前进、后退信息)
//navigator
const ua = navigator.userAgent //获取浏览器的信息
const isChrome = ua.indexOf('Chrome')

//screen
console.log(screen.width)
console.log(screen.height)

//location
console.log(location.href)
console.log(location.protocol)//"http:" "https:"
console.log(location.pathname)
console.log(location.search)
console.log(location.hash)

//history
history.back()
history.forward()

image.png

相关文章
相关标签/搜索