[JavaScript初级面试]7. WEB API - BOM(Browser Object Model)

题目

  • 如何识别浏览器的类型
  • 如何拆解url各个部分
const ua = navigator.userAgent
ua.indexOf('Chrome') // 无法准确确定是何种浏览器

screen

screen.width
screen.height

location

location.href
location.protocol
location.host
location.search // ?xxxx=xxx
location.hash // #xx
location.pathname // 除去域名:端口

history

history.back()
history.forward()
posted @ 2021-09-06 10:26  Max力出奇迹  阅读(27)  评论(0编辑  收藏  举报
返回顶部↑