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

2021/9/6 11:07:16

本文主要是介绍[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()


这篇关于[JavaScript初级面试]7. WEB API - BOM(Browser Object Model)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程