题目
- 如何识别浏览器的类型
- 分析拆解url各个部分
const ua = navigator.userAgent
const isChrome = ua.indexOf('Chrome')
console.log(isChrome)
console.log(location.href)
console.log(location.protocol)
console.log(location.pathname)
console.log(location.search)
console.log(location.hash)
分析:www.baidu.com/?a=2&b=3#ac…

知识点
- navigator
- screen
- location
- history
navigator 和 screen
const ua = navigator.userAgent
const isChrome = ua.indexOf('Chrome')
console.log(isChrome)
console.log(screen.width)
console.log(screen.height)
location和history
console.log(location.href)
console.log(location.protocol)
console.log(location.pathname)
console.log(location.search)
console.log(location.hash)
history.back()
history.forward()